Cod sursa(job #373174)

Utilizator Teodor94Teodor Plop Teodor94 Data 12 decembrie 2009 20:49:40
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.6 kb
#include<cstdio>
#include<string>

const int N=1<<25;

char s[N];

int main()
{
	freopen("text.in","r",stdin);
	freopen("text.out","w",stdout);
	gets(s);
	long long n=strlen(s)-1,nrc=0,lg=0;
	for (int i=0;i<=n;i++)
	{
		int x=(int)s[i];
		if ((x>=65 && x<=90) || (x>=97 && x<=122))
		{
			lg++;
			/*if (i==n-1)
				nrc++;
			else*/
			//{
				/*int y=(int)s[i-1];
				if (y<65 || (y>90 && y<97) || y>123)
					nrc++;*/
				int y=(int)s[i+1];
				if (y<65 || (y>90 && y<97) || y>123 || s[i+1]=='\0' || s[i+1]=='\n')
					nrc++;
			//}
		}
	}
	printf("%lld",lg/nrc);
	return 0;
}