Cod sursa(job #2672040)

Utilizator Alex_tz307Lorintz Alexandru Alex_tz307 Data 12 noiembrie 2020 23:04:39
Problema Text Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.4 kb
#include <bits/stdc++.h>

using namespace std;

ifstream fin("text.in");
ofstream fout("text.out");

const int NMAX = 1e7;
char s[NMAX], sep[] = " -.,:;!?'0123456789";

int main() {
    fin.getline(s, sizeof(s));
    int sum = 0, cnt = 0;
    char *p = strtok(s, sep);
    while(p) {
        sum += strlen(p);
        ++cnt;
        p = strtok(nullptr, sep);
    }
    fout << sum / cnt;
}