#include<cstdio>
#include<cstring>`
const int MAX_LEN = 10005;
char a[MAX_LEN], b[MAX_LEN];
bool hashtable[128];//记录你字符是否在第二个字符串里出现过
int main()
{
gets_s(a);
gets_s(b);
int lenA = strlen(a);//strlen必须在
int lenB = strlen(b);
for (int i = 0; i < lenB; i++) {
hashtable[b[i]] = true;//第二个字符串里的字符的table值置true
}
for (int i = 0; i < lenA; i++) {
if (hashtable[a[i]] == false) {//如果早第二个字符串里没有出现过
printf("%c", a[i]);
}
}
return 0;
}
(PAT甲)1050 String Subtraction
最新推荐文章于 2024-07-16 05:02:51 发布