#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int s[1000];
int h[1000];
int main()
{
#ifdef LOCAL
freopen("data.in","r",stdin);
freopen("data.out","w",stdout);
#endif // LOCAL
char str[100];
char cpy[100];
gets(str);
gets(cpy);
int len=strlen(str);
for(int i=0;i<len;i++){
if(str[i]<='z' && str[i]>='a') str[i]-=32;
h[str[i]]++;
}
int len1=strlen(cpy);
for(int i=0;i<len1;i++){
if(cpy[i]<='z' && cpy[i]>='a') cpy[i]-=32;
s[cpy[i]]++;
}
for(int i=0;i<len;i++){
if(h[str[i]] && s[str[i]]==0){
printf("%c",str[i]);
s[str[i]]++;
}
}
return 0;
}
【PAT】1084. Broken Keyboard
最新推荐文章于 2021-08-21 19:22:40 发布