Cod sursa(job #869892)

Utilizator TimopallTimoficiuc Paul Timopall Data 2 februarie 2013 15:44:23
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.44 kb
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
bool litera(char a)
{
	return a<='z'&&a>='a'||a<='Z'&&a>='A';
}
int main()
{
	char a[1004];int i,nr=0,s=0,l;bool k=0;
	freopen("text.in","r",stdin);freopen("text.out","w",stdout);
	cin.get(a,1004);
	l=strlen(a);
	for(i=0;i<l;i++)
		if(litera(a[i]))
		{
			if(k==0)
				nr++,k=1;
			s++;
		}
		else
			k=0;
	if(nr)
	    cout<<s/nr;
	else
		cout<<0;
	
}