Cod sursa(job #1178778)

Utilizator AndreiBarbutaAndrei Barbuta AndreiBarbuta Data 27 aprilie 2014 11:18:01
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.42 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;
}