Cod sursa(job #805764)

Utilizator AndreilAndrei Lecu Andreil Data 1 noiembrie 2012 08:59:21
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.34 kb
#include<fstream>
#include<string.h>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
char s[1048576],*p;
int l,n;
int main(){
fin.get(s,1048576);
p=strtok(s,"-, ;:.!?()[]_<>{}");
while(p)
{
	n++;
	l=l+strlen(p);
	p=strtok(NULL,"-, ;:.!?()[]_<>{}");
}
if(n==0)
	fout<<0;
else
fout<<l/n;
return 0;
}