Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int freq[30];
- void addChar(char c) {
- if ('A' <= c && c <= 'Z') c += 'a' - 'A';
- if ('a' <= c && c <= 'z') freq[c - 'a']++;
- }
- int main() {
- // freopen("in", "r", stdin);
- // freopen("out", "w", stdout);
- int t;
- scanf("%d ", &t);
- while (t--) {
- char s[210];
- fgets(s, 210, stdin);
- memset(freq, 0, sizeof freq);
- for (int i = 0; s[i]; i++) addChar(s[i]);
- int maxi = *max_element(freq, freq + 30);
- for (int i = 0; i < 26; i++) {
- if (freq[i] == maxi) printf("%c", 'a' + i);
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement