Cod sursa(job #1988637)

Utilizator zimoRazvan Bota zimo Data 3 iunie 2017 21:15:55
Problema Text Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.39 kb
#include <iostream>
#include <fstream>
#include <cstring>

using namespace std;

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