Cod sursa(job #1276178)

Utilizator andrei.arnautuAndi Arnautu andrei.arnautu Data 26 noiembrie 2014 00:20:17
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 kb
#include <cstdio>
#include <cstring>
using namespace std;
FILE *fin=freopen("text.in","r",stdin);
FILE *fout=freopen("text.out","w",stdout);
char *p, S[1000000], Sep[] = " -!?.,";
int Len, Nr;

int main()
{
    gets(S);
    p = strtok(S, Sep);
    while( p != NULL )
    {
        ++Nr;
        Len += strlen(p);
        p = strtok(NULL, Sep);
    }
    printf("%d", Len / Nr);
    return 0;
}