-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1255.cpp
More file actions
54 lines (41 loc) · 905 Bytes
/
1255.cpp
File metadata and controls
54 lines (41 loc) · 905 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
43
44
45
46
47
48
49
50
51
52
53
54
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <cctype>
#include <vector>
using namespace std;
int main(){
int testes;
string linha;
cin >> testes;
cin.ignore();
for(int i=0; i<testes; i++){
int maior = 0;
vector<char> aux;
map<char, int> letras;
getline(cin, linha);
for(auto c : linha){
if(isalpha(c)){
c = tolower(c);
letras[c]++;
}
}
for(auto l : letras){
if(l.second > maior) {
maior = l.second;
}
}
for(auto m : letras){
if(m.second == maior) {
aux.push_back(m.first);
}
}
sort(aux.begin(), aux.end());
for(auto r : aux){
cout << r;
}
cout << endl;
}
return 0;
}