Cod sursa(job #581986)
Utilizator | Data | 14 aprilie 2011 19:31:18 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include<fstream>
#include<string.h>
using namespace std;
char sir[1000005];
ifstream f("text.in");
ofstream g("text.out");
int main ()
{
char sep[]=" -?!.,",*p;
int cuv,total;
f.get(sir,1000000);
total=0;
cuv=0;
p=strtok(sir,sep);
while (p)
{
cuv++;
total+=strlen(p);
p=strtok(NULL,sep);
}
g<<total/cuv;
return 0;
}