-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathamusing_joke.cpp
More file actions
36 lines (27 loc) · 749 Bytes
/
amusing_joke.cpp
File metadata and controls
36 lines (27 loc) · 749 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
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
string guest, host, pile;
bool theres_host, theres_guest;
int i, j, aux=0;
cin >> guest >> host >> pile;
for(i=0;i<guest.size();i++)
for(j=0;j<pile.size();j++)
if(guest[i] == pile[j]){
pile[j] = '#';
aux++;
break;
}
theres_guest = (aux == guest.size()) ? true : false;
aux=0;
for(i=0;i<host.size();i++)
for(j=0;j<pile.size();j++)
if(host[i] == pile[j]){
pile[j] = '#';
aux++;
break;
}
theres_host = (aux == host.size()) ? true : false;
cout << ((pile.find_first_not_of('#') == -1 && theres_host && theres_guest) ? "YES" : "NO" ) << endl;
return 0;
}