Pagini recente » Cod sursa (job #1736538) | Cod sursa (job #363970) | Cod sursa (job #1493113) | Cod sursa (job #3191423) | Cod sursa (job #1160170)
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
int count(char string[])
{
int wlength=0;
int nwords=0;
int inword=0;
int length=strlen(string);
int i;
printf("%s",string);
for(i=0;i<length;i++)
{
if(isalpha(string[i]))
{
inword=1;
++wlength;
if(i==length-1)
++nwords;
}
else
{
if(inword)
{
++nwords;
inword=0;
}
}
}
return wlength/nwords;
}
int main()
{
char string[100000];
freopen("text.in","r",stdin);
freopen("text.out","w",stdout);
scanf("%s",string);
int nwords=count(string);
printf("%d",nwords);
return 0;
}