Cod sursa(job #823232)

Utilizator thewildnathNathan Wildenberg thewildnath Data 24 noiembrie 2012 19:47:37
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.47 kb
#include<stdio.h>
using namespace std;
int f(char c)
{
	if(c>='a'&&c<='z')
		return 1;
	if(c>='A'&&c<='Z')
		return 1;
	return 0;
}
int main()
{
	freopen("text.in","r",stdin);
	freopen("text.out","w",stdout);
	int g=0,nr=0,s=0;
	char c;
	while(scanf("%c",&c)==1)
	{
		if(f(c)==1)
		{
			nr++;
			g=1;
		}
		else
			if(g==1)
			{
				s++;
			    g=0;
			}
	}
	if(g==1)
		s++;
	if(s==0)
		printf("0\n");
	else
		printf("%d\n",nr/s);
	return 0;
}