Cod sursa(job #178107)

Utilizator AndreyPAndrei Poenaru AndreyP Data 14 aprilie 2008 08:44:00
Problema Text Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.4 kb
#include<stdio.h>
int main()
{
	freopen("text.in","r",stdin);
	freopen("text.out","w",stdout);
	int nc=0,nl=0;
	char x;
	bool ok=false;
	scanf("%c",&x);
	while(x!='\n')
	{
		if((x>='A')&&(x<='Z')||(x>='a')&&(x<='z'))
		{
			nl++;
			ok=true;
		}
		else
		{
			if(ok)
			{
				nc++;
				ok=false;
			}
		}
		scanf("%c",&x);
	}
	if(ok)
		nc++;
	printf("%d\n",nl/nc);
	return 0;
}