Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define IN 1
- #define OUT 0
- int main()
- {
- int c, symbols, words, state;
- state = OUT;
- symbols = words = 0;
- while ((c = getchar()) != '\n')
- {
- ++symbols;
- if (c == ' ' || c == '\t')
- state = OUT;
- else if (state == OUT)
- {
- state = IN;
- ++words;
- }
- }
- printf ("Слов: %d\n", words);
- printf ("Символов: %d\n", symbols);
- return 0;
- }
Add Comment
Please, Sign In to add comment