Cod sursa(job #373178)

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

const int N=1<<30;

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==0)
				nrc++;
			else
			{
				int y=(int)s[i-1];
				if (y<65 || (y>90 && y<97) || y>123)
					nrc++;
			}
		}
	}
	printf("%lld",lg/nrc);
	return 0;
}