Cod sursa(job #798924)

Utilizator tibi9876Marin Tiberiu tibi9876 Data 17 octombrie 2012 16:31:22
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.44 kb
#include<cstdio>
using namespace std;

char x;
int ok,i,nr,p;

bool litera(char x)
{
	if ((('a'<=x) && (x<='z')) || (('A'<=x) && (x<='Z')))
		return true;
	else return false;
}

int main()
{
	freopen("text.in","r",stdin);
	freopen("text.out","w",stdout);
	ok=0;
	while (scanf("%c",&x)!=EOF)
	{
		if (litera(x))
		{
			if (ok==0)
			{
				nr++;
				ok=1;
			}
			p++;
		}
		else ok=0;
	}
	printf("%d",p/nr);
}