1084. Broken Keyboard (20)
来源:互联网 发布:linux java环境变量 编辑:程序博客网 时间:2024/06/16 04:41
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_esSample Output:
7TI
set
#include<cstdio>#include<cmath>#include<algorithm>#include<iostream>#include<cstring>#include<queue>#include<vector>#include<map>#include<set>using namespace std;int main(){char s1[100];gets(s1);set<char> fz1; for(int i=0;i<strlen(s1);i++){ if(s1[i]>='a'&&s1[i]<='z'){ s1[i]-=32; fz1.insert(s1[i]);}else fz1.insert(s1[i]);} char s2[100];gets(s2);for(int i=0;i<strlen(s2);i++){ if(s2[i]>='a'&&s2[i]<='z'){ s2[i]-=32; fz1.erase(s2[i]);}else{ fz1.erase(s2[i]);}} for(int i=0;i<strlen(s1);i++){ if(fz1.find(s1[i])!=fz1.end()){ cout<<s1[i]; fz1.erase(s1[i]);} } //set<int> ss;//ss.insert(1);return 0;}
- 1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20)
- 第3章-对象的共享
- 最小生成树总结
- 6038 Function
- delphi中New 与 GetMem 形似神不似
- 2017多校第一场 HDU 6041 I Curse Myself Tarjan找环+K路归并
- 1084. Broken Keyboard (20)
- 开放3306端口,远程连接MySQL
- HTML之meta&&响应式布局
- 【hdoj 3081】Marriage Match II 【并查集orfloyd +完美匹配】or【最大流+二分+并查集】
- webapck 雪碧图
- 2017-07-27 DBA日记,使用Python解释mysql 5.6 slowquery.log
- java反射入门基础
- wps如何显示左侧文档结构图
- webview调试