zoukankan      html  css  js  c++  java
  • 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;
    }
  • 相关阅读:
    day 01
    day14
    day12
    day13
    day11
    day9
    day10
    day08
    day07
    day06
  • 原文地址:https://www.cnblogs.com/langyao/p/7251869.html
Copyright © 2011-2022 走看看