Codeforces Round #127 (Div. 2), problem: (A) LLPS editorial: http://codeforces.com/blog/entry/4808
Codeforces Round #127 (Div. 2), problem: (A) LLPS solution: http://ideone.com/1idKo6
#include <iostream> #include <cstdio> #include <cstring> using namespace std; int main() { int a[30]={0}, flag=0; char s[15]; scanf("%s", s); for(int i=0; i<strlen(s); i++) a[s[i]-'a']++; for(int i=27; i>=0; i--) if(a[i]>0 && flag==0) while(a[i]>0) printf("%c", i+'a'), a[i]--, flag=1; return 0; }
No comments:
Post a Comment