PAT (Advanced Level) Practise 1084 Broken Keyboard (20)
来源:互联网 发布:软件测试结论 编辑:程序博客网 时间:2024/04/20 05:51
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<cstdio>#include<stack>#include<string>#include<vector>#include<cstring>#include<iostream>#include<algorithm>using namespace std;typedef long long LL;const int maxn = 1e5 + 10;char a[maxn], b[maxn];int flag[maxn];int main(){scanf("%s%s", a, b);for (int i = 0; b[i]; i++){if ('a' <= b[i] && b[i] <= 'z') b[i] -= 32;flag[b[i]] = 1;}for (int i = 0; a[i]; i++){if ('a' <= a[i] && a[i] <= 'z') a[i] -= 32;if (!flag[a[i]]){printf("%c", a[i]);flag[a[i]] = 1;}}return 0;}
- PAT (Advanced Level) Practise 1084 Broken Keyboard (20)
- PAT (Advanced Level) Practise 1084 Broken Keyboard (20)
- Pat(Advanced Level)Practice--1084(Broken Keyboard)
- 【PAT】【Advanced Level】1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20)【字符串操作】——PAT (Advanced Level) Practise
- PAT (Advanced Level) Practise 1112 Stucked Keyboard (20)
- PAT (Advanced Level) Practise 1112 Stucked Keyboard (20)
- PAT (Advanced Level) 1084. Broken Keyboard (20) 坏键盘,字符串处理
- [PAT] (Advanced Level) Practise
- PAT (Advanced Level) Practise
- PAT (Advanced Level) Practise
- PAT (Advanced Level) Practise
- PAT (Advanced Level) Practise
- PAT (Advanced Level) Practise
- PAT (Advanced Level) Practise
- PAT (Advanced Level) Practise
- PAT (Advanced Level) Practise
- PAT (Advanced Level) Practise
- 大话数据结构第一章
- C++ 内存
- SystemServer分析过程
- bootstrap 入门
- java实现动态切换上网IP (ADSL拨号上网)
- PAT (Advanced Level) Practise 1084 Broken Keyboard (20)
- java设计模式之创建型模式-简单工厂模式
- 设置代理
- Selenium RC服务器命令行参数列表
- 3.Java Networking: ServerSocket--java网络:服务端Socket
- 在 Eclipse 下利用 gradle 构建系统
- 关于mybatis扩展的一点想法
- 详解cookie
- 使用eclipse开发Android时,打开layout文件闪退