fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int main()
  4. {
  5. char c;
  6. int letters=0;
  7. int space=0;
  8. int digit=0;
  9. int other=0;
  10. printf ("請輸入一行字元:>");
  11.  
  12. while ((c=getchar())!='\n')
  13. {
  14. if ((c >= 'a' && c <= 'z')||(c >= 'A' && c <= 'Z'))
  15. {
  16. letters++;
  17. }
  18. else if (' ' == c)
  19. {
  20. space++;
  21. }
  22. else if (c >= '0' && c <= '9')
  23. {
  24. digit++;
  25. }
  26. else
  27. {
  28. other++;
  29. }
  30. }
  31. printf ("字母的個數:>%d\n空格的個數:>%d\
  32. \n數字的個數:>%d\n其他字元的個數:>%d\n",\
  33. letters,space,digit,other);
  34. system ("pause");
  35. return 0;
  36. }
Time limit exceeded #stdin #stdout 5s 4448KB
stdin
the 1234
stdout
Standard output is empty