1084. Broken Keyboard (20)
来源:互联网 发布:历代windows壁纸 编辑:程序博客网 时间:2024/05/04 16:37
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_esSample Output:
7TI
#include<iostream>#include<string>using namespace std;int main(){int i,j=0,t=0,m,flag;char c[80],c1[40];string str1,str2;string::iterator it1,it2;cin>>str1>>str2;it2=str2.begin();for(it1=str1.begin();it1!=str1.end();it1++){if((*it1)==(*it2)){it2++;}else{c[j++]=(*it1);}}for(i=0;i<j;i++){flag=0;if(c[i]>='a' && c[i]<='z')c[i]=c[i]-'a'+'A';if(t==0){c1[t++]=c[i];}else{for(m=0;m<t;m++){if(c[i]==c1[m])flag=1;}if(flag==0)c1[t++]=c[i];}}for(i=0;i<t;i++)cout<<c1[i];cout<<endl;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)
- 【设计模式】原型模式
- 代理模式(Python版)---为别人做嫁衣
- 运筹帷幄之中,决胜千里之外——运筹学1-3章
- 算法练习系列—hiho1044 状态压缩二(捡垃圾)
- c_基础_获取main函数返回值
- 1084. Broken Keyboard (20)
- 简单位操作
- java IO操作
- 运筹学总结—好不好总结就好
- CentOS 使用yum命令安装Java SDK(openjdk)
- centos外接屏幕调节方法
- 572
- weiphp伪静态开启方法
- 高手教你将PPT幻灯片变成SWF动画