Cod sursa(job #2069083)

Utilizator Urdoi.BogdanUrdoi Bogdan Urdoi.Bogdan Data 18 noiembrie 2017 11:55:49
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.42 kb
#include <fstream>
#include <cstring>

using namespace std;

ifstream f("text.in");
ofstream g("text.out");

int main()
{
    char s [4001], *p;
    int lungime = 0, numarCuv = 0;
    f.get(s, 4001);
    p = strtok(s, " ,.!-?/\()[]{};:'|`");
    while (p){
        lungime += strlen(p);
        numarCuv ++;
        p = strtok(NULL, " ,.!-?/\()[]{};:'|`");
    }
    g << lungime / numarCuv;
    return 0;
}