PAT甲级练习1084. Broken Keyboard (20)
来源:互联网 发布:form.js 跨域上传文件 编辑:程序博客网 时间:2024/05/17 11:35
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 <cstdio> #include <algorithm> #include <vector> #include <map> #include <set> #include <stack> #include <queue> #include <string> #include <string.h> using namespace std;const int inf = 99999999;const int MAX = 1e5+10;char s1[MAX],s2[MAX];bool b[256];int main() {int n, cnt=0;gets(s1);gets(s2);for(int i=0; i<strlen(s2); i++){if(s2[i]<='z' && s2[i]>='a')s2[i]+='A'-'a';if(!b[s2[i]]) b[s2[i]] = true;}for(int i=0; i<strlen(s1); i++){if(s1[i]<='z' && s1[i]>='a')s1[i]+='A'-'a';if(!b[s1[i]]){printf("%c", s1[i]);b[s1[i]] = true;}}scanf("%d",&n); return 0;}
- PAT甲级练习1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20)-PAT甲级试题
- PAT(甲级)1084. Broken Keyboard (20)
- PAT 甲级 1084. Broken Keyboard (20)
- pat 1084. Broken Keyboard (20)
- PAT 1084. Broken Keyboard (20)
- PAT 1084. Broken Keyboard (20)
- pat 1084. Broken Keyboard (20)
- PAT 1084. Broken Keyboard (20)
- 【PAT】1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20) PAT
- 1029. 旧键盘(20) PAT乙级&1084. Broken Keyboard (20)PAT甲级
- PAT 1084. Broken Keyboard
- PAT 1084. Broken Keyboard
- 【PAT】1084. Broken Keyboard
- pat 1084. Broken Keyboard
- PAT Broken Keyboard (20)
- PAT A 1084. Broken Keyboard (20)
- The sum problem
- Java简单的生产者与消费者实现
- 定位设备--llseek实现
- vfork不是用return返回的原因
- 配置hadoop环境
- PAT甲级练习1084. Broken Keyboard (20)
- javascript常用函数和技巧
- Struts2分页
- Java基础之I/O框架体系
- Android源码编译常见错误(持续更新)
- Linux的高级命令,进一步了解Linux的指令
- JavaScript 常用函数总结
- 1042. 字符统计(20)
- javascript库函数大全