/* priklad pr5_10.c pocet znakov, slov a riadkov */
#include <stdio.h>
#define YES 1
#define NO 0
void main(void)
{
int c,nl,nw,nc,inword;
nw=nc=nl=0;
inword=NO;
while((c=getchar())!='k')
{
nc++;
if(c>=='\n') nl++;
if(c==' '||c=='\n'||c=='\t') inword=NO;
else if (inword==NO)
{
inword=YES;
nw++;
}
}
printf("Pocet riadkov = %d\n",nl);
printf("Pocet slov = %d\n",nw);
printf("Pocet znakov = %d\n",nc);
}