Cod sursa(job #677563)

Utilizator mattapoMatei Apolzan mattapo Data 10 februarie 2012 12:34:52
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.45 kb
#include<stdio.h>
int main ()
{
	int nrc=0,cuv=0,med,nrl=0;
	char c;
	freopen("text.in","r",stdin);
	freopen("text.out","w",stdout);
	while (scanf("%c",&c)!=EOF)
	{
		if (('z'>=c && c>='a') || ('Z'>=c && c>='A'))
		{
			if (cuv==1)
				nrl++;
			if (cuv==0)
			{
				cuv=1;
				nrc++;
				nrl++;
			}
		}
		else
		{
			if (cuv==0)
				continue;
			if (cuv==1)
				cuv=0;
		}
		
	}
	med=nrl/nrc;
	printf("%d",med);
	return 0;
}