Cod sursa(job #1492224)

Utilizator MayuriMayuri Mayuri Data 27 septembrie 2015 13:25:33
Problema Text Scor 70
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.42 kb
#include <cstdio>
#include <cstring>

using namespace std;

char s[10000100], sep[] = " -,?!.", *p;

int main() {
    freopen("text.in", "r", stdin);
    freopen("text.out", "w", stdout);

    int n = 0, let = 0;

    while(gets(s) > 0) {
    p = strtok(s, sep);
    while(p) {
        ++ n;
        let += strlen(p);
        p = strtok(NULL, sep);
    }
    }

    printf("%d", let / n);

    return 0;
}