25 lines
460 B
C
25 lines
460 B
C
#include <stdio.h>
|
|
|
|
#define IN 1
|
|
#define OUT 0
|
|
|
|
int main() {
|
|
int character, lines, words, chars, state;
|
|
|
|
state = OUT;
|
|
lines = words = chars = 0;
|
|
while ((character = getchar()) != EOF) {
|
|
++chars;
|
|
if (character == '\n')
|
|
++lines;
|
|
if (character == ' ' || character == '\n' || character == '\t')
|
|
state = OUT;
|
|
else if (state == OUT) {
|
|
state = IN;
|
|
++words;
|
|
}
|
|
}
|
|
|
|
printf("\n%d %d %d\n", lines, words, chars);
|
|
}
|