Cod sursa(job #921294)

Utilizator gbi250Gabriela Moldovan gbi250 Data 20 martie 2013 21:40:58
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.42 kb
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
char s[1500001], *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;
}