Cod sursa(job #1492221)

Utilizator MayuriMayuri Mayuri Data 27 septembrie 2015 13:22:50
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 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);

    gets(s);

    int n = 0, let = 0;

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

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

    return 0;
}