fork download
  1. #include <stdio.h>
  2.  
  3. int main(){
  4.  
  5. int i, j, small, capital, space, number;
  6. small = 0; capital = 0; space = 0; number = 0;
  7. char str[101]={0, };
  8.  
  9. for (i=0; i<101; i++) {
  10. str[i] = -1;
  11. }
  12.  
  13. for (i=0; i<100; i++) {
  14.  
  15. scanf("%100[^\n]", str);
  16.  
  17. for (j=0; j<105; j++){
  18. if (str[j]>='a' && str[j]<='z') {
  19. small++;
  20. } else if (str[j]>='A' && str[j]<='Z') {
  21. capital++;
  22. } else if (str[j]==32) { // 공백 문자의 ASCII 코드가 32
  23. space++;
  24. } else if (str[j]>='0' && str[j]<='9') {
  25. number++;
  26. }
  27. }
  28.  
  29. printf("%d %d %d %d\n", small, capital, number, space);
  30.  
  31. small = 0; capital = 0; number = 0; space = 0;
  32.  
  33. for (j=0; j<101; j++) {
  34. str[j] = -1;
  35. }
  36. getchar(); // 버퍼 비우기
  37. }
  38.  
  39. return 0;
  40. }
Success #stdin #stdout 0s 9424KB
stdin
This is String
SPACE    1    SPACE
 S a M p L e I n P u T     
0L1A2S3T4L5I6N7E8
stdout
10 2 0 2
0 10 1 8
5 6 0 16
0 8 9 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0