fork download
  1. #include <stdio.h>
  2. #include <ctype.h>
  3. #include <string.h>
  4.  
  5.  
  6. int main(int argc, char *argv[])
  7. {
  8. int i, j, k, length;
  9. char str[81];
  10. int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0;
  11.  
  12. for ( k = 0; k <= 5; k++)
  13. {
  14. while (((str[i] = getchar()) != '\n') && (i < 80))
  15. i++;
  16. str[i] = '\0';
  17.  
  18. length = strlen(str);
  19.  
  20. for (j = 0; j < length; j++)
  21. {
  22. if (isalpha(str[j]))
  23. a++;
  24. if (islower(str[j]))
  25. b++;
  26. if (isupper(str[j]))
  27. c++;
  28. if (isdigit(str[j]))
  29. d++;
  30. if (isalnum(str[j]))
  31. e++;
  32. else
  33. f++;
  34. }
  35.  
  36. printf("String length == %i\n", length);
  37. printf("Alphabetic == %i\n", a);
  38. printf("Lower case == %i\n", b);
  39. printf("Upper case == %i\n", c);
  40. printf("Numeric == %i\n", d);
  41. printf("Alpanumeric == %i\n", e);
  42. printf("Others == %i\n", f);
  43. }
  44.  
  45. return 0;
  46. }
Success #stdin #stdout 0s 2296KB
stdin
1234QWERasdf!@#$
stdout
String length == 80
Alphabetic == 8
Lower case == 4
Upper case == 4
Numeric == 4
Alpanumeric == 12
Others == 68
String length == 80
Alphabetic == 16
Lower case == 8
Upper case == 8
Numeric == 8
Alpanumeric == 24
Others == 136
String length == 80
Alphabetic == 24
Lower case == 12
Upper case == 12
Numeric == 12
Alpanumeric == 36
Others == 204
String length == 80
Alphabetic == 32
Lower case == 16
Upper case == 16
Numeric == 16
Alpanumeric == 48
Others == 272
String length == 80
Alphabetic == 40
Lower case == 20
Upper case == 20
Numeric == 20
Alpanumeric == 60
Others == 340
String length == 80
Alphabetic == 48
Lower case == 24
Upper case == 24
Numeric == 24
Alpanumeric == 72
Others == 408