PAT_A1050
PAT甲级1050.
目录
A1050
题目
样例
输入:
They are students.
aeiou
输出:
Thy r stdnts.
思路和坑点
将第二个字符串分成字符标记出来,然后遍历输出第一个字符串,只要遇到第二个字符串中的字母,不输出即可。
AC代码
#include<bits/stdc++.h>
using namespace std;
int main(void){
#ifdef ONLINE_JUDGE
#else
freopen("1.txt","r",stdin);
#endif
unordered_map<char,bool> mp;
string s;
getline(cin,s);
char ch;
while((ch=getchar())!='\n'){
mp[ch]=true;
}
for(int i=0;i<s.size();i++){
if(mp[s[i]])
continue;
putchar(s[i]);
}
return 0;
}