Cod sursa(job #1696941)

Utilizator GabiTulbaGabi Tulba-Lecu GabiTulba Data 30 aprilie 2016 13:16:58
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.43 kb
#include <cstdio>

using namespace std;

int lenght=0,words=0;
char ch;
bool chstart=false,chend=false;
int main()
{
	freopen("text.in","r",stdin);
	freopen("text.out","w",stdout);
	while(scanf("%c",&ch)!=EOF)
	{
		if((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z'))
		{
			chstart=true;
			lenght++;
		}
		else
			if(chstart==true)
			{
				chstart=false;
				words++;
			}

	}
	printf("%d",lenght/words);
	return 0;
}