1084 Broken Keyboard

s2没有出现s1中的字符,并且转换大写后没有出现在答案中(答案不用重复出现相同),把这个字符加入答案。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <bits/stdc++.h>
using namespace std;

int main() {
string s1, s2, res;
cin >> s1 >> s2;
for (int i = 0; i < s1.length(); i++) {
if (s2.find(s1[i]) == string::npos && res.find(toupper(s1[i])) == string::npos) {
res += toupper(s1[i]);
}
}
cout << res << endl;

return 0;
}

7_This_is_a_test
_hs_s_a_es

7TI