1084 Broken Keyboard (20 分)

On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on screen.

Now given a string that you are supposed to type, and the string that you actually type out, please list those keys which are for sure worn out.

Input Specification:

Each input file contains one test case. For each case, the 1st line contains the original string, and the 2nd line contains the typed-out string. Each string contains no more than 80 characters which are either English letters [A-Z] (case insensitive), digital numbers [0-9], or _ (representing the space). It is guaranteed that both strings are non-empty.

Output Specification:

For each test case, print in one line the keys that are worn out, in the order of being detected. The English letters must be capitalized. Each worn out key must be printed once only. It is guaranteed that there is at least one worn out key.

Sample Input:

7_This_is_a_test
_hs_s_a_es

Sample Output:

7TI

分析:注意字符串结尾是string::npos, 7行搞定!

 /**
 * Copyright(c)
 * All rights reserved.
 * Author : Mered1th
 * Date : 2019-02-25-19.55.33
 * Description : A1084
 */
 #include<cstdio>
 #include<cstring>
 #include<iostream>
 #include<cmath>
 #include<algorithm>
 #include<string>
 #include<unordered_set>
 #include<map>
 #include<vector>
 #include<set>
 #include<unordered_map>
 using namespace std;
 int main(){
 #ifdef ONLINE_JUDGE
 #else
     freopen("1.txt", "r", stdin);
 #endif
     string s1,s2,ans="";
     cin>>s1>>s2;
     ;i<s1.length();i++){
         if(s2.find(s1[i])==string::npos &&ans.find(toupper(s1[i]))==string::npos){
             ans+=toupper(s1[i]);
         }
     }
     cout<<ans;
     ;
 }

1084 Broken Keyboard (20 分)的更多相关文章

  1. 【PAT甲级】1084 Broken Keyboard (20 分)

    题意: 输入两行字符串,输出第一行有而第二行没有的字符(对大小写不敏感且全部以大写输出). AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC #inclu ...

  2. 1084. Broken Keyboard (20)【字符串操作】——PAT (Advanced Level) Practise

    题目信息 1084. Broken Keyboard (20) 时间限制200 ms 内存限制65536 kB 代码长度限制16000 B On a broken keyboard, some of ...

  3. 1084. Broken Keyboard (20)

    On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters ...

  4. PAT Advanced 1084 Broken Keyboard (20) [Hash散列]

    题目 On a broken keyboard, some of the keys are worn out. So when you type some sentences, the charact ...

  5. PAT (Advanced Level) 1084. Broken Keyboard (20)

    简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...

  6. 1084. Broken Keyboard (20)-水题

    #include <iostream> #include <cstdio> #include <string.h> #include <algorithm&g ...

  7. PAT 1084 Broken Keyboard

    1084 Broken Keyboard (20 分)   On a broken keyboard, some of the keys are worn out. So when you type ...

  8. pat1084. Broken Keyboard (20)

    1084. Broken Keyboard (20) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue On a ...

  9. pat 1084 Broken Keyboard(20 分)

    1084 Broken Keyboard(20 分) On a broken keyboard, some of the keys are worn out. So when you type som ...

随机推荐

  1. 添加MyEclipse WebSphere Portal Server支持(二)

    MyEclipse个人授权 折扣低至冰点!立即开抢>> [MyEclipse最新版下载] 三.支持WebSphere Portal部署 当您为WebSphere Portal 7.0或8. ...

  2. LinkedStack<T>

    public class LinkedStack<T> { private static class Node<U> { U item; Node<U> next; ...

  3. 【设计模式】 模式PK:工厂模式VS建造者模式

    1.概述 工厂方法模式注重的是整体对象的创建方法,而建造者模式注重的是部件构建的过程,旨在通过一步一步地精确构造创建出一个复杂的对象.我们举个简单例子来说明两者的差异,如要制造一个超人,如果使用工厂方 ...

  4. 在C#中如何定义一个变长的结构数组?如果定义好了,如何获得当前数组的长度?

    用ArrayList,他就相当于动态数组,用add方法添加元素,remove删除元素,count计算长度

  5. myecilpse +TOMCAT+web:jsp向mysql添加数据,查询在jsp页面显示

    <%@ page language="java" import="java.util.*" import="com.mysql.jdbc.Dri ...

  6. Thumbnailator java图片压缩,加水印,批量生成缩略图

    地址:http://code.google.com/p/thumbnailator/ 1.指定大小进行缩放 //size(宽度, 高度) /* * 若图片横比200小,高比300小,不变 * 若图片横 ...

  7. iOS-----使用NSOperation与NSOperationQueue实现多线程

    使用NSOperation与NSOperationQueue实现多线程 NSOperation与NSOperationQueue的基本理论如下. NSOperationQueue 代表一个FIFO的队 ...

  8. 在 Windows 10 中开启移动 WLAN 热点

    本文将介绍如何在 Windows 10 中开启移动 Wi-Fi 热点. This post is written in multiple languages. Please select yours: ...

  9. Omar Loves Candies

    题目大意:在一个N * M的格子中,放有一些糖,这些糖有的会损害健康,有的对健康有益.有损害的被记为负数,有益的会记为正数.另外,对于每一个糖而言,他都比左边的糖和上面的糖更健康. 现在我要在在N*M ...

  10. 个人博客:有态度的HBase/Spark/BigData

    个人博客:有态度的HBase/Spark/BigData 关于我 本人范欣欣,男,就职于网易杭州研究院后台技术中心数据库技术组,专注于HBase的开发运维,热衷于MySQL等相关数据库技术.联系方式: ...