fork download
  1. #include <stdio.h>
  2. /* подcчет цифр, cимволов-разделителей и прочих cимволов */
  3. int main()
  4. {
  5. int c, i, nwhite, nother, letters;
  6. int ndigit[10];
  7. nwhite = nother = letters= 0;
  8. for (i = 0; i < 10; ++i)
  9. ndigit[i]= 0;
  10. while ((c = getchar()) != EOF)
  11. if (c >= '0' && c <= '9' )
  12. ++ndigit[c - '0' ];
  13. else if (c == ' ' || c == '\n' || c == '\t')
  14. ++nwhite;
  15. else if ( c == 'a'||c =='b'||c =='c'||c =='d'||c =='e'||c =='f'||c =='g'||c =='h'||c =='j'||c =='k'||c =='l'||c =='q'||c =='w'||c =='r'||c =='t'||c =='y'||c =='u'||c =='i'||c =='o'||c =='p'||c =='s'||c =='z'||c =='x'||c =='v'||c =='n'||c =='m'||c =='A'||c =='S'||c =='D'||c =='F'||c =='G'||c =='H'||c =='J'||c =='K'||c =='L'||c =='Z'||c =='X'||c =='C'||c =='V'||c =='B'||c =='N'||c =='M'||c == 'Q'||c =='W'||c =='E'||c =='R'||c =='T'||c =='Y'||c =='U'||c =='I'||c =='O'||c =='P')
  16. ++ letters;
  17. else
  18. ++nother;
  19. printf ("цифры =");
  20. for (i=0; i < 10; ++i)
  21. printf(" %d", ndigit[i]);
  22. printf (", cимволы-разделители = %d, буквы= %d, прочие = %d\n", nwhite,letters, nother);
  23. return 0;
  24. }
Success #stdin #stdout 0.01s 5284KB
stdin
fyY67 8IIrt
stdout
цифры = 0 0 0 0 0 0 1 1 1 0, cимволы-разделители = 1, буквы= 7, прочие = 0