Advertisement
tobast

Untitled

Nov 4th, 2012
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.74 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <ctype.h>
  4.  
  5. int main()
  6. {
  7.     char texte[10001], lettre;
  8.     int i, indice, tableau[26]= {0};
  9.  
  10.     scanf("%[\n]\n", texte);
  11.  
  12.     int taille = strlen(texte);
  13.     printf("%s\n", texte);
  14.  
  15.     for(i=0; i<taille; i++)
  16.     {
  17.         if(texte[i]>='a' && texte[i]<='z')
  18.         {
  19.             lettre = texte[i];
  20.             indice = lettre -'a';
  21.             printf("%d\t", indice);
  22.             tableau[indice] = tableau[indice] + 1;
  23.         }
  24.         else if(texte[i]>='A' && texte[i]<='Z')
  25.         {
  26.             lettre = texte[i];
  27.             indice = lettre-'A';
  28.             printf("%d\t", indice);
  29.             tableau[indice] = tableau[indice] + 1;
  30.         }
  31.     }
  32.     printf("\n");
  33.     int max=0;
  34.     for(i=0; i<26; i++)
  35.     {
  36.         printf("%c : %d\n", (char)(i+'A'), tableau[i]);
  37.         if(tableau[i]>tableau[max])
  38.             max=i;
  39.     }
  40.     printf("%c\n", max+'A');
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement