Cod sursa(job #893053)

Utilizator DemnokStefan Demnok Data 26 februarie 2013 12:48:42
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.42 kb
#include <cstdio>
#include <string.h>
int x,nr;
char *p,s[10000],sep[]={"- ,.!;_?><12345678890"};
int main ()
{
    freopen("text.in","r",stdin);
    freopen("text.out","w",stdout);
    gets(s);
    p=strtok(s,sep);
    if(strlen(p)) x++,nr+=strlen(p);
    while (p)
    {
        p=strtok(NULL,sep);
        if(p==NULL) break;
        if(strlen(p)) x++,nr+=strlen(p);
    }
    printf("%ld",nr/x);
    return 0;
}