Cod sursa(job #470883)

Utilizator Anonymous1010Chilivercu Cristian Anonymous1010 Data 15 iulie 2010 21:14:09
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.4 kb
#include<stdio.h>

char c;
int nr,l,ok;

int main()
{
	freopen("text.in","r",stdin);
	freopen("text.out","w",stdout);
	
	for(;!feof(stdin);scanf("%c",&c))
	{		
		if(('a'<=c&&'z'>=c)||('A'<=c&&'Z'>=c))
		{
			l++;
			if(ok)
				nr++,ok=0;
		}
		else
			ok=1;
		
	}
	
	
	if(!nr)
	{
		if(l)
			printf("%d",l);
		else
			printf("0");
	}
	else
		printf("%d",l/nr);
	
	return 0;
}