k9core/src/wc.c

21 lines
290 B
C
Raw Normal View History

2020-06-16 16:52:17 +00:00
#include <stdio.h>
int
main(void)
{
char c;
int newlines = 0, spaces = 0, bytes = 0;
while((c = getchar()) != EOF)
{
bytes++;
if(c == '\n')
newlines++;
if(c == ' ')
spaces++;
}
printf("%i %i %i\n",newlines,spaces,bytes);
return 0;
}