Cod sursa(job #196857)

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

#define NMAX 2000000

char s[NMAX];
char c;

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

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

	c='a';
	L=-1;
	while (c!='\0')
	{
		c='\0';
		scanf("%c",&c);
		s[++L]=c;
	}

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

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