Ytu 2775: The argument of the alphabet

Source: Internet
Author: User
2775: The argument of the alphabetTime limit:1 Sec Memory limit:128 MB
submit:84 solved:57
[Submit] [Status] [Web Board] Description

One day, 26 lowercase English letters argued, they all want to be the boss, make a fuss. At this time the small armor of the tease think of a good way to calm them down, the rule is this: read a line consisting only of lowercase English letter string, statistics these 26 lowercase English letters in this string of characters appear in the number of times, who appeared this number of who is the eldest. In addition, the lowercase English letters that do not appear in this string of characters can only be beats me. Although this approach to some of the letters some unfair, but people still bite the bullet to accept. Well, now that the problem is coming, smart you can make up the procedure to help them solve it.

Input

A single string of lowercase English letters, with no other types of characters.

Output

Output the highest number of letters and times, and output ASCII large if the number of occurrences is the same

Sample Input

Goodgoodstudydaydayup
Sample Output
D:5
HINT

Source

Zhuang Liu &oj

AC Code:

#include <stdarg.h>
#include <iostream>
#include <math.h>
#include <iomanip>
#include <cctype>
#include <cstring>
#include <algorithm>
using namespace std;
int main () {
    string s;
    while (cin>>s) {
        int len=s.length ();
        int p[26],t[26],z;
        memset (P,0,sizeof (P));
        memset (t,0,sizeof (t));
        for (int i=0;i<len;i++) {
            if (Islower (S[i])) {
                z=s[i]-96;
                p[z]++;
            }
        }
        int max=-111,oo=0;
    for (int i=0;i<26;i++) {
            if (P[i]>max) {
                max=p[i];
                oo=i;
            }
    }
    Sort (p,p+26);
    char c;
    cout<< (c=oo+96+ ') << ":" <<p[25]<< ' \12 ';
    }
    return 0;
}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.