Cod sursa(job #196850)

Utilizator devilkindSavin Tiberiu devilkind Data 29 iunie 2008 17:43:49
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.52 kb
#include <stdio.h>
#include <string.h>

#define NMAX 20000000

char s[NMAX];

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

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

	while ( fgets(s,NMAX,stdin) )
	{

	for (L=0;s[L]!='\n';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;
}