Cod sursa(job #1988640)

Utilizator zimoRazvan Bota zimo Data 3 iunie 2017 21:19:03
Problema Text Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 kb
#include <iostream>
#include <fstream>
#include <cstring>
#define M 1000000

using namespace std;

int main()
{
    char s[M], *p;
    int cuv = 0, x = 1;
    ifstream f("text.in");
    ofstream g("text.out");
    f.get(s, M);
    p = strtok(s, " ,()""''[]-/.!?;");
    while(p)
    {
        cuv += strlen(p);
        p = strtok(NULL, " ,.!?;");
        x++;
    }
    g << cuv/x;
    return 0;
}