Cod sursa(job #329402)

Utilizator DraStiKDragos Oprica DraStiK Data 6 iulie 2009 09:26:36
Problema Text Scor 100
Compilator cpp Status done
Runda splunge1 Marime 0.55 kb
#include <stdio.h>
#include <ctype.h>
#define DIM 1000001

int lgt,nrc,n;
char p[DIM];


void read_solve ()
{
    int lg;
	for (lg=0; scanf ("%c",&p[++n])!=EOF; )
    {
        if (isalpha (p[n]))
            ++lg;
        else if (lg)
        {
            lgt+=lg;
            lg=0;
            ++nrc;
        }
    }
    if (lg)
    {
        ++nrc;
        lgt+=lg;
    }
    printf ("%d",lgt/nrc);
}

int main ()
{
    freopen ("text.in","r",stdin);
    freopen ("text.out","w",stdout);
    read_solve ();
    return 0;
}