-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2136.cpp
More file actions
36 lines (28 loc) · 671 Bytes
/
2136.cpp
File metadata and controls
36 lines (28 loc) · 671 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 <iostream>
#include <set>
using namespace std;
int main(){
string nome, escolha, maior;
set<string> amigos;
set<string> naoAmigos;
while(true){
cin >> nome;
if(nome == "FIM") break;
cin >> escolha;
if(escolha == "YES") {
if(nome.size() > maior.size()) maior = nome;
amigos.insert(nome);
} else {
naoAmigos.insert(nome);
}
}
for(const auto &a : amigos){
cout << a << endl;
}
for(const auto &na : naoAmigos){
cout << na << endl;
}
cout << endl << "Amigo do Habay:" << endl;
cout << maior << endl;
return 0;
}