Cod sursa(job #561387)

Utilizator nicknameLare Nicu nickname Data 20 martie 2011 01:35:35
Problema Text Scor 50
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 kb
#include <fstream>
#include <string.h>

using namespace std;

ifstream fin("text.in");
ofstream fout("text.out");

int main(){
	char *s,sep[]=". ,-!?:;1234567890",*t;
	long long nrw=0, len=0;
	s=new char [11111111];
	fin.getline(s,11111110,EOF);
	t=strtok(s,sep);
	while (t!=NULL){
		nrw++;
		len+=strlen(t);
		t=strtok(NULL,sep);
	}
	fout<<(long long)(len/nrw);
	delete [] s;
	fin.close();
	fout.close();
	return 0;
}