Cod sursa(job #972630)
| Utilizator | Data | 12 iulie 2013 11:59:57 | |
|---|---|---|---|
| Problema | Text | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <fstream>
#include <string.h>
using namespace std;
int main()
{
string textf,line;
char *token;
long sum=0,word_number=0;
ifstream fin("text.in");
ofstream fout("text.out");
while ( fin.good() )
{
getline (fin,line);
token=(char *) strtok(&line[0]," ,.-)(?/}{");
while(token!=NULL)
{
sum+=strlen(token);
word_number++;
token=strtok(NULL," ,.-)(?/}{");
}
}
fout<<sum/word_number;
return 0;
}
