Cod sursa(job #252974)

Utilizator mottyMatei-Dan Epure motty Data 5 februarie 2009 11:04:36
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.52 kb
#include<stdio.h>

bool litt(char ch)
{
	if(ch>='a' && ch<='z')
		return true;
	if(ch>='A' && ch<='Z')
		return true;
	return false;
}

void calc()
{
	char ch,ex;
	int lit=0,cuv=0;
	scanf("%c",&ch);
	if(litt(ch)==true)
	{
		++lit;
		++cuv;
	}
	ex=ch;
	while (scanf("%c",&ch)!=EOF)
	{
		if(litt(ch)==true)
		{
			++lit;
			if(litt(ex)==false)
				++cuv;
		}
		ex=ch;
	}
	printf("%d",lit/cuv);
}

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