Cod sursa(job #549244)

Utilizator romykPrehari Romica romyk Data 8 martie 2011 11:49:35
Problema Text Scor 60
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.37 kb
#include <iostream>
#include<fstream>
#include<string.h>
using namespace std;
fstream f("text.in",ios::in);
fstream g("text.out",ios::out);
long i,n,nrc;
char a[20000000],*p;
int main()
{n=0;
nrc=0;
while(!f.eof())
{f>>a;
if(!f.eof())
{
p=strtok(a," .,!?-");
while(p)
{
   nrc++;
   n=n+strlen(p);
   p=strtok(NULL," .,!?-");
}
}
}
g<<n/nrc;

return 0;
}