PAT (Basic Level) Practise (中文)1029. 旧键盘(20)
2017-11-07 21:43
393 查看
1029. 旧键盘(20)
时间限制200 ms
内存限制
65536 kB
代码长度限制
8000 B
判题程序
Standard
作者
CHEN, Yue
旧键盘上坏了几个键,于是在敲一段文字的时候,对应的字符就不会出现。现在给出应该输入的一段文字、以及实际被输入的文字,请你列出肯定坏掉的那些键。
输入格式:
输入在2行中分别给出应该输入的文字、以及实际被输入的文字。每段文字是不超过80个字符的串,由字母A-Z(包括大、小写)、数字0-9、以及下划线“_”(代表空格)组成。题目保证2个字符串均非空。
输出格式:
按照发现顺序,在一行中输出坏掉的键。其中英文字母只输出大写,每个坏键只输出一次。题目保证至少有1个坏键。
输入样例:
7_This_is_a_test _hs_s_a_es
输出样例:
7TI
#include <cstdio>
#include <cstring>
#include <cctype>
const int maxn=85;
char s1[maxn],s2[maxn];
int main(){
bool Hash[128]={false};
gets(s1);
gets(s2);
int len1=strlen(s1);
int len2=strlen(s2);
for(int i=0;i<len1;i++){
int j;
char c1,c2;
for(j=0;j<len2;j++){
c1=s1[i],c2=s2[j];
if(islower(c1)) c1=toupper(c1);
if(islower(c2)) c2=toupper(c2);
if(c1==c2) break;
}
if(j==len2&&Hash[c1]==false){
printf("%c",c1);
Hash[c1]=true;
}
}
return 0;
}
相关文章推荐
- 【PAT】(Basic Level) Practise (中文)1029. 旧键盘(20)
- PAT (Basic Level) Practise (中文)1029. 旧键盘(20)
- PAT (Basic Level) Practise (中文)-1029. 旧键盘(20)
- PAT (Basic Level) Practise (中文) 1029. 旧键盘(20)
- PAT (Basic Level) Practise (中文)1029. 旧键盘(20)
- PAT (Basic Level) Practise (中文)1029. 旧键盘(20) C语言
- PAT (Basic Level) Practise (中文) 1033. 旧键盘打字(20)
- PAT (Basic Level) Practise (中文)1033. 旧键盘打字(20)
- PAT (Basic Level) Practise (中文)1033. 旧键盘打字(20)
- PAT (Basic Level) Practise (中文)-1033. 旧键盘打字(20)
- PAT (Basic Level) Practise (中文)1033. 旧键盘打字(20) C语言
- PAT (Basic Level) Practise (中文) 1079. 延迟的回文数 (20)
- PAT (Basic Level) Practise (中文)- 1012. 数字分类 (20)
- PAT (Basic Level) Practise (中文)1003. 我要通过!(20)
- PAT (Basic Level) Practise (中文)1019. 数字黑洞 (20)
- PAT (Basic Level) Practise (中文)1047. 编程团体赛(20)
- PAT (Basic Level) Practise (中文)1017. A除以B (20)
- PAT (Basic Level) Practise (中文)- 1022. D进制的A+B (20)
- PAT (Basic Level) Practise (中文)- 1007. 素数对猜想 (20)
- PAT (Basic Level) Practise (中文) 1014. 福尔摩斯的约会 (20)