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. DevExpress v17.2最新版帮助文档下载大全

    DevExpress v17.2.4帮助文档下载列表大全来啦!包含.NET.VCL.HTML/JS系列所有帮助文档,提供CHM和PDF两个版本.除已停止更新的Silverlight.Windows 8 ...

  2. 《C语言中分配了动态内存后一定要释放吗?》

    问:比如main函数里有一句 malloc(),后面没有free()1.那么当main结束后,动态分配的内存不会随之释放吗?2.如果程序结束能自动释放,那么还加上free(),是出于什么考虑? 答: ...

  3. Cisco ASA(8.4)端口映射设定(ASDM)

    1.进入到Configuration→firewall→NAT Rules画面. 2.点“services”添加服务端口,此案例添加TCP 1443和UDP 1443端口映射 3.添加“Network ...

  4. webstrom git 版本控制

    1.配置 2.用法

  5. WEB接口测试之Jmeter接口测试自动化 (二)

    通过逐个录入的方式,好不容易将需要测试几十个接口的300多个测试用例录入sampler-http请求中,固定的测试环境跑起来也还 感觉良好.不料在新服务器环境中跑用例时,问题来了:修改参数维护脚本等成 ...

  6. C高级第四次作业

    作业要求一 最简单的wordcount 具体要求:http://www.cnblogs.com/xinz/p/7426280.html 1.设计思路: 0.0版本设计思路: 第一步:读入用户想要操作的 ...

  7. Binary file to C array(bin2c)

    /******************************************************************************** * Binary file to C ...

  8. 【opencv基础】OpenCV从Mat中提取某些行或列

    这两个函数返回的是指向原矩阵内部位置的指针,类似于浅拷贝: code cv::Mat align_mean(cv::Mat mean, cv::Rect facebox, float scaling_ ...

  9. 在intent-filter中的配置

    1.scheme约束和mimetype的数据类型,这些都可以自己去定义. 2.但是由于在MainActivity却不能直接将这两个参数分开来写,例如setdata和settype,这样会互相删除. 因 ...

  10. 《DSP using MATLAB》Problem 3.5

    定义为: 如果序列绝对可和,其DTFT就存在.