NYOJ--241--字母统计

/*
    Name: NYOJ--241--字母统计
    Date: 18/04/17 17:12
    Description: 水过,C++11特性不能用,尴尬 
*/
#include<bits/stdc++.h> 
using namespace std;
int main(){
//    freopen("in.txt","r",stdin) ;
    int t;cin>>t;
    while(t--) {
        int ct1[27];
        int ct[27];
        memset(ct,0,sizeof(ct));
        string str;
        cin>>str;
        for(int i=0;i<str.size(); ++i)ct[str[i]-97]++;
        copy(ct,ct+27,ct1);
        sort(ct,ct+27);
        int temp = ct[26];
        for(int i=0; i<26; ++i){
            if(ct1[i] == temp){
                cout<<char(i+97)<<endl;
                break;
            }
        }
    }
    return 0;
}

 

posted @ 2017-04-18 17:16  朤尧  阅读(194)  评论(0编辑  收藏  举报