Cod sursa(job #2110683)

Utilizator constantin.gabrielConstantin Gabriel constantin.gabriel Data 21 ianuarie 2018 10:10:12
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 kb
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char s[256];
long long sum,nr;
int main()
{
    f.get(s,256);
    char * pch;
    pch = strtok (s," ,.-!?()*&^%$#@/;:'+*");
    while (pch != NULL)
    {
        sum+=strlen(pch);
        nr++;
        pch = strtok (NULL, " ,.-!?()*&^%$#@/;:'+*");
    }
    g<<sum/nr;
}