1084. Broken Keyboard
来源:互联网 发布:mysql数据库 pdf 编辑:程序博客网 时间:2024/05/24 04:39
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<stdio.h>#include<string>#include<string.h>using namespace std;int buf[258];int main(){freopen("F://Temp/input.txt", "r", stdin);for(int i = 0; i < 258; i ++)buf[i] = 0;string original, now;cin>>original;cin>>now;for(int i = 0; i < now.size(); i ++){if(now[i] >= 'a' && now[i] <= 'z')buf[now[i]-32] ++;elsebuf[now[i]] ++;}for(int i = 0; i < original.size(); i ++){if(original[i] >= 'a' && original[i] <= 'z'){if(buf[original[i]-32] == 0){buf[original[i]-32] --;cout<<(char)(original[i]-32);}}else if(buf[original[i]] == 0){buf[original[i]] --;cout<<original[i];}}printf("\n");return 0;}
- PAT 1084. Broken Keyboard
- 1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20)
- 1084.Broken Keyboard
- 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
- 1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20)
- Python中遇到的错误(随时更新)
- HDOJ 3342 Legal or Not (拓扑排序)
- 大数加法(C语言)
- 编写linux静态库
- iOS中几种数据持久化方案:我要永远地记住你!
- 1084. Broken Keyboard
- 二分法_1
- 第13周——Floyd算法验证
- 来淄博旅游
- WordPress主题制作入门(2)-add_theme_support() 函数
- POJ 3067 Japan 【树状数组 向下更新 向上求和】
- 常见MATLAB小技巧
- HDOJ 4324 Triangle LOVE (拓扑排序)
- android development