-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1029.cpp
More file actions
42 lines (39 loc) · 740 Bytes
/
1029.cpp
File metadata and controls
42 lines (39 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include<iostream>
#include<string>
using namespace std;
int main(){
string s1, s2;
cin >> s1;
cin >> s2;
int num1[200] = {}, num2[200] = {};
string tmp;
for (int i = 0; i < s1.size(); i++){
if (s1[i] >= 'a'&&s1[i] <= 'z')
s1[i] = s1[i] - 32;
num1[s1[i]]++;
}
for (int i = 0; i < s2.size(); i++){
if (s2[i] >= 'a'&&s2[i] <= 'z')
s2[i] = s2[i] - 32;
num2[s2[i]]++;
}
for (int i = 0; i < 200; i++){
if (num1[i] != 0 && num2[i] == 0)
tmp.push_back((char)i);
}
int k = 0;
for (int i = 0; i < s1.size(); i++){
for (int j = 0; j < tmp.size(); j++){
if (s1[i] == tmp[j]){
cout << s1[i];
tmp[j] = 999;
k++;
break;
}
}
if (k == (tmp.size()))
break;
}
system("pause");
return 0;
}