Cod sursa(job #1677029)

Utilizator AndreiTudorSpiruAndrei Spiru AndreiTudorSpiru Data 6 aprilie 2016 12:12:38
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.37 kb
#include <fstream>
#include <cstring>
using namespace std;
char s[1000001],*p;
ifstream f("text.in");
ofstream g("text.out");
long nr,suma;
int main()
{
    f.getline(s,1000001);
    p=strtok(s,"-,. !?@#$%^&*()+=;:[]{}\|");
    while(p)
    {nr++;
    suma+=strlen(p);
    p=strtok(NULL,"-,. !?@#$%^&*()+=;:'[]{}\|");
    }
    g<<suma/nr;
    return 0;
}