1084. Broken Keyboard
来源:互联网 发布:dw for mac中文破解版 编辑:程序博客网 时间:2024/05/20 06:42
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 <cstdlib>
#include <iostream>
#include <deque>
#include <queue>
#include <cstring>
#include <vector>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <stack>
#include <cmath>
#include <algorithm>
using namespace std;
#define max1 100001
#define inf -1
int main()
{
vector<int>a(500,0);
string s1,s2;
cin>>s1;
cin>>s2;
for(int i=0;i<s2.length();i++)
{
if('a'<=s2[i]&&s2[i]<='z')
{
a[s2[i]-32]=1;
}
else
a[s2[i]]=1;
}
/*for(int i=0;i<500;i++)
{
if(a[i]!=0)
cout<<i<<' ';
}*/
for(int i=0;i<s1.length();i++)
{
if('a'<=s1[i]&&s1[i]<='z')
{
if(a[s1[i]-32]!=1)
{
a[s1[i]-32]=1;
cout<<(char)(s1[i]-32);
}
}
else
{
if(a[s1[i]]!=1)
{
a[s1[i]]=1;
cout<<s1[i];
}
}
}
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)
- 2.7、优先级和类型转换分析
- 1083. List Grades
- 详细的Dagger2+MVP融合,一行一行分析,一点一点进步,之一
- 测试字符串中是否包含重复字符
- Android stadio 工具使用
- 1084. Broken Keyboard
- HTTP协议详解
- KMP——模板整理
- 403. Frog Jump
- 部署笔记-centos 7.0 mysql篇
- 1085. Perfect Sequence
- MYSQL搜索引擎
- 最长对称子串
- POJ