-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path141A.cpp
More file actions
38 lines (33 loc) · 856 Bytes
/
141A.cpp
File metadata and controls
38 lines (33 loc) · 856 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
#include<iostream>
#include<iterator>
#include<map>
using namespace std;
void count_letters(map<char, int> &m, string str){
for(int i=0; i<str.length(); i++){
auto itr = m.find(str[i]);
if(itr == m.end()) m.insert({str[i], 1});
else itr->second++;
}
}
void rest_letters(map<char, int> &m, string str){
for(int i=0; i<str.length(); i++){
auto itr = m.find(str[i]);
if(itr == m.end()) m.insert({str[i], -1});
else itr->second--;
}
}
int main(){
map<char, int> m;
string s1, s2, s3;
cin >> s1 >> s2 >> s3;
count_letters(m, s1);
count_letters(m, s2);
rest_letters(m, s3);
for(auto itr = m.begin(); itr != m.end(); itr++){
if(itr->second != 0){
cout << "NO" << endl;
return 0;
}
} cout << "YES" << endl;
return 0;
}