Pagini recente » Cod sursa (job #93626) | Cod sursa (job #2096825) | Cod sursa (job #1358455) | Cod sursa (job #1129298) | Cod sursa (job #34236)
Cod sursa(job #34236)
#include<stdio.h>
int main()
{
long count=0,sum=0,current=0;
char c,sw=0;
freopen("text.in","r",stdin);
while(!feof(stdin))
{
scanf("%c",&c);
if(!feof(stdin) && (c>='a' && c<='z') || (c>='A' && c<='Z'))
{current++;sw=1;}
else
{
if(sw==1){sw=0;count++;sum+=current;current=0;}
}
}
if(sw==1){sw=0;count++;sum+=current;current=0;}
fclose(stdin);
freopen("text.out","w",stdout);
if(count==0){printf("0");}
else{printf("%ld",sum/count);}
fclose(stdout);
return 0;
}