Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- int T, i, max;
- string line;
- cin >> T;
- while(T--) {
- int Alpha[26] = {0};
- cin.sync();
- getline(cin, line);
- for(i = 0; line[i]; i++) {
- if(line[i] >= 65 && line[i] <= 91)
- Alpha[line[i] - 65]++;
- else if(line[i] >= 97 && line[i] <= 122)
- Alpha[line[i] - 97]++;
- }
- for(i = 1, max = 0; i < 26; i++)
- max = (Alpha[i] > Alpha[max]) ? i : max;
- for(i = 0; i < 26; i++) {
- char ch = i + 97;
- if(Alpha[i] == Alpha[max]) cout << ch;
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement