Cod sursa(job #390601)
Utilizator | Data | 4 februarie 2010 01:21:26 | |
---|---|---|---|
Problema | Text | Scor | 90 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
# include <fstream>
# include <cstring>
using namespace std;
int main ()
{
int nrc=0, l=0, lc;
char c[2000000], sep[]="~`!^*()_-+=}{]\[;:\"\'|<,>.?/", *p;
ifstream fin ("text.in");
ofstream fout ("text.out");
while (fin>>c)
{
p=strtok(c, sep);
while (p)
{
lc=strlen(p);
if (lc)nrc++, l+=lc;
p=strtok(NULL, sep);
}
}
fout<<l/nrc;
return 0;
}