Cod sursa(job #196848)

Utilizator devilkindSavin Tiberiu devilkind Data 29 iunie 2008 17:36:12
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.51 kb
#include <stdio.h>
#include <string.h>

#define NMAX 2000000

char s[NMAX];

int main()
{
	freopen("text.in","r",stdin);
	freopen("text.out","w",stdout);

	fgets(s,NMAX,stdin);

	long int i,j,nc=0,lc=0,k,L;

	for (L=0;s[L]!='\0';L++);

	for (i=0;i<=L;i=j+1)
	{
		j=i;
		k=0;
		if ( ( (s[j]>='A')&&(s[j]<='Z') ) || ( (s[j]>='a')&&(s[j]<='z') ) ) {nc++;k=1;}
		while ( ( (s[j]>='A')&&(s[j]<='Z') ) || ( (s[j]>='a')&&(s[j]<='z') ) ) {j++;lc++;}
		j-=k;
	}

//	printf("%ld %ld ",lc,nc);
	printf("%ld",lc/nc);
	return 0;
}