fork download
  1. #include <stdio.h>
  2. int main() {
  3. char s[1000005];
  4. scanf("%s",&s);
  5. int count = 0;
  6. int word = 0;
  7. for (int i = 0; s[i]; i++) {
  8. if ((s[i] >= 'a' && s[i] <= 'z') ||
  9. (s[i] >= 'A' && s[i] <= 'Z')) {
  10.  
  11. if (word == 0) {
  12. count++;
  13. }
  14. }
  15. else{
  16. word = 1;
  17. }
  18. }
  19. printf("%d\n", count);
  20. }
  21.  
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
0