Cod sursa(job #921291)

Utilizator gbi250Gabriela Moldovan gbi250 Data 20 martie 2013 21:37:52
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.39 kb
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
char s[1000001], *p;
int nr, ma;
int main()
{
    freopen("text.in", "r", stdin);
    freopen("text.out", "w", stdout);
    gets(s);

    p=strtok(s, " ,.!;'?-");

    while(p!=NULL)
    {
        nr++;
        ma+=strlen(p);
        p=strtok(NULL, " ,.!;'?-");
    }
    printf("%d\n", ma/nr);
    return 0;
}