Cod sursa(job #228266)

Utilizator AthanaricCirith Gorgor Athanaric Data 6 decembrie 2008 20:33:21
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.61 kb
#include <stdio.h>
#define Size 1000005
char c[Size];
void Read()
{
	int x=0,pozi=0,pozf=0,sum=0,nc=0,ok=0;
	scanf("%c",&c[x]);
	while (c[x]!='\0')
		scanf("%c",&c[++x]);
	int Length=x;
	for (x=0; x<=Length; x++)
		if ((65<=c[x]&&c[x]<=90)|(97<=c[x]&&c[x]<=122))
			{
				ok++;
				pozf++;
				if (x==Length)
				{
					sum+=Length-pozi;
					nc++;
				}
			}
			else
			{
				if (ok)
				{
					sum+=pozf-pozi;
					nc++;
				}
				ok=0;
				pozi=pozf+1;
				pozf=pozi;
			}
	printf("%d\n",sum/nc);
}
int main()
{
	freopen("text.in","r",stdin);
	freopen("text.out","w",stdout);
	Read();
}