|
|
вернуться в форумWhy i got wrong answer #include <cstdio> #include <cstring> int n[25], k[2]; char ch[50]; int main(){ scanf("%s",ch); int x = strlen(ch); for ( int i = 0; i < x; i++ ) n[ch[i]-'a']++; for ( int i = 0; i < 24; i++ ) if ( n[i] > k[0] ){ k[0] = n[i]; k[1] = i; } printf("%c", k[1]+'a'); scanf("\n"); return 0; } No subject Edited by author 25.08.2011 18:32 Re: Why i got wrong answer There are 26 letters in English alphabet =) Also beware about /0 char in the end of line, use char ch[51], MAXLEN+1. Re: Why i got wrong answer i change it and still wrong |
|
|