Cod sursa(job #401473)

Utilizator avram_florinavram florin constantin avram_florin Data 22 februarie 2010 21:19:47
Problema Text Scor 100
Compilator cpp Status done
Runda pcon1 Marime 0.42 kb
#include<fstream>
#include<cstring>

using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int len,cuv,rez,sep;
char ch;

int main ()
{
	f.get(ch);
	while(!f.eof())
		{
			if((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z'))
				{
					len++;
					if(!sep)
						cuv++;
					sep=1;
				}
				else
				sep=0;
			f.get(ch);
		}
	rez=len/cuv;
	g<<rez<<'\n';
	f.close();
	g.close();
	return 0;
}