Cod sursa(job #397905)

Utilizator loginLogin Iustin Anca login Data 17 februarie 2010 18:01:32
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
# include <fstream>
# include <cstring>
using namespace std;

int main ()
{
	long long int nrc=0, l=0, lc;
	char c[206000], sep[]="\`~1234567890!{@#$%^&**()-}|\":+?=><,./;[]", *p;
	ifstream fin ("text.in");
	ofstream fout ("text.out");
	while (fin>>c)
	{
		p=strtok(c, sep);
		while (p)
		{
			lc=strlen(p);
			if (lc)nrc++, l+=lc;
			p=strtok(NULL, sep);
		}
	}
	fout<<l/nrc;
	return 0;
}