AcWing 1570. 坏掉的键盘
原题链接
简单
作者:
Value
,
2020-05-31 12:12:34
,
所有人可见
,
阅读 555
#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;
unordered_map<char, bool> good;
unordered_map<char, bool> flag;
vector<char> res;
int main(){
string s1, s2;
getline(cin, s1);
getline(cin, s2);
for(int i = 0 ; i < s2.size(); i ++ ){
if(s2[i] >= 'a' && s2[i] <= 'z') s2[i] -= 32;
good[s2[i]] = true;
}
for(int i = 0; i <s1.size(); i ++ ){
if(s1[i] >= 'a' && s1[i] <= 'z') s1[i] -= 32;
if(good.find(s1[i]) == good.end() && flag.find(s1[i]) == flag.end()){
flag[s1[i]] = true;
res.push_back(s1[i]);
}
}
for(auto item : res) cout << item;
return 0;
}