Codeforces Round #127 (Div. 2)

来源:互联网 发布:2016最火的网络歌曲 编辑:程序博客网 时间:2024/05/20 06:51

A.LLPS

题解:说了那么多其实很简单,把字母按照ASCII码排个序,输出ASCII码最大的字母,有多少就输出多少。

代码:

#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;bool cmp(char a,char b){    return a>b;}int main(){    char str[15]; char x;    int l;    while(~scanf("%s",str))    {        l=strlen(str);        sort(str,str+l,cmp);        x=str[0];        for(int i=0;i<l;i++)        {            if(str[i]==x)                cout<<str[i];        }        cout<<endl;    }    return 0;}


0 0