Pagini recente » Cod sursa (job #937136) | Cod sursa (job #561269) | Cod sursa (job #1152495) | Cod sursa (job #972920) | Cod sursa (job #390600)
Cod sursa(job #390600)
# 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;
}