Cod sursa(job #238550)

Utilizator luk17Luca Bogdan luk17 Data 2 ianuarie 2009 16:06:12
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.55 kb
#include<stdio.h>
#include<string.h>
long nrcuv,lung,n,i;
char s[1000010],x,prec;
int main()
{
	freopen("text.in","r",stdin);
	freopen("text.out","w",stdout);
	while(!feof(stdin))
	scanf("%c",&s[n++]);
	
	if((s[0]>='a'&&s[0]<='z')||(s[0]>='Z'&&s[0]<='Z'))
	{
		lung++;
	nrcuv=1;
	}	
	for(i=1;i<n;i++)
	{
		
	if(((s[i]>='a'&&s[i]<='z')||(s[i]>='A'&&s[i]<='Z')))
	{
		lung++;
		if(!((s[i-1]>='a'&&s[i-1]<='z')||(s[i-1]>='A'&&s[i-1]<='Z')))
			nrcuv++;
	}		
	}
	if(lung==0)
printf("0");
	else
	printf("%ld",lung/nrcuv);
	return 0;
}