Cod sursa(job #359796)

Utilizator DeadEyeNaiba Mihai Lucian DeadEye Data 28 octombrie 2009 13:10:53
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.72 kb
#include<cstdio>
int main()
{
	char c1,c2;
	int nl,nc;
	freopen("text.in","r",stdin);
	freopen("text.out","w",stdout);
	c1=' ';
	nc=0; nl=0;
	while(scanf("%c", &c2)!=EOF)
	{
		if(c2=='\n')
		{
			if(( ( (int)c1>=65 && (int)c1<=90) || ( (int)c1>=97 && (int) c1<=122) ))
			    nc++;
			printf("%d\n",(int)nl/nc);
			return 0;
		}
		if(!( ( (int)c2>=65 && (int)c2<=90) || ( (int)c2>=97 && (int) c2<=122) ) && ( ( (int)c1>=65 && (int)c1<=90) || ( (int)c1>=97 && (int) c1<=122) ))
			nc++;
		else if(( ( (int)c2>=65 && (int)c2<=90) || ( (int)c2>=97 && (int) c2<=122) ))
			nl++;
		c1=c2;
	}
	if(( ( (int)c1>=65 && (int)c1<=90) || ( (int)c1>=97 && (int) c1<=122) ))
		nc++;
	printf("%d\n",(int)nl/nc);
	return 0;
}