【pat】b1029旧键盘

two points两个字符串

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

#include<cstdio>
#include<string.h>
#include<ctype.h>
char str1[81],str2[81];
using namespace std;
bool shuru[200],shiji[200];
int main(){
scanf("%s",str1);
scanf("%s",str2);
for(int i=0;i<strlen(str2);i++){
shiji[str2[i]]=true;
}
for(int i=0;i<strlen(str1);i++){
if(shuru[str1[i]]!=true&&shiji[str1[i]]==false){//如果输入了,而且没有输出过
shuru[str1[i]]=true;
if(islower(str1[i])){
if(shiji[str1[i]]==false&&shuru[str1[i]-32]==false){
printf("%c",str1[i]-32);
shuru[str1[i]-32]=true;
}
continue;
}
printf("%c",str1[i]);
}
}
return 0;
}