Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- int main()
- {
- char texte[10001], lettre;
- int i, indice, tableau[26]= {0};
- scanf("%[\n]\n", texte);
- int taille = strlen(texte);
- printf("%s\n", texte);
- for(i=0; i<taille; i++)
- {
- if(texte[i]>='a' && texte[i]<='z')
- {
- lettre = texte[i];
- indice = lettre -'a';
- printf("%d\t", indice);
- tableau[indice] = tableau[indice] + 1;
- }
- else if(texte[i]>='A' && texte[i]<='Z')
- {
- lettre = texte[i];
- indice = lettre-'A';
- printf("%d\t", indice);
- tableau[indice] = tableau[indice] + 1;
- }
- }
- printf("\n");
- int max=0;
- for(i=0; i<26; i++)
- {
- printf("%c : %d\n", (char)(i+'A'), tableau[i]);
- if(tableau[i]>tableau[max])
- max=i;
- }
- printf("%c\n", max+'A');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement