Cod sursa(job #1178685)

Utilizator AndreiBarbutaAndrei Barbuta AndreiBarbuta Data 27 aprilie 2014 00:27:15
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.39 kb
#include <cstdio>
#include <cstring>

using namespace std;

char *p,s[1000005];

int main()
{
    freopen("text.in","r",stdin);
    freopen("text.out","w",stdout);
    int sum=0,nr=0;
    gets(s);
    p=strtok(s," ,.!?:;-_#$%^&*+=");
    while(p){
        sum=sum+strlen(p);
        nr++;
        p=strtok(NULL," ,.!?:;-_#$%^&*+=");
    }
    printf("%d\n",sum/nr);
    return 0;
}