Guest User

Untitled

a guest
Jul 22nd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. #define IN 1
  4. #define OUT 0
  5.  
  6. int main()
  7. {
  8. int c, symbols, words, state;
  9. state = OUT;
  10. symbols = words = 0;
  11.  
  12. while ((c = getchar()) != '\n')
  13. {
  14. ++symbols;
  15. if (c == ' ' || c == '\t')
  16. state = OUT;
  17. else if (state == OUT)
  18. {
  19. state = IN;
  20. ++words;
  21. }
  22. }
  23.  
  24. printf ("Слов: %d\n", words);
  25. printf ("Символов: %d\n", symbols);
  26.  
  27. return 0;
  28. }
Add Comment
Please, Sign In to add comment