Pagini recente » Cod sursa (job #2014318) | Cod sursa (job #2631245) | Cod sursa (job #513329) | Cod sursa (job #269530) | Cod sursa (job #1554786)
#include <fstream>
#include <cstring>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char s[1200000],*p,sep[200],ch;
int l=0,nr=0;
int main ()
{
for(ch=32;ch<=126;ch++)
if(!((ch>='a' && ch<='z') || (ch>='A' && ch<='Z')))
{
sep[l]=ch;
l++;
}
sep[l]=0;
l=0;
while(f.get(s,1200000))
{
p=strtok(s,sep);
while (p!=NULL)
{
nr++;
l=l+strlen(p);
p=strtok(NULL,sep);
}
}
g<<l/nr;
g.close();
return 0;
}