Cod sursa(job #211361)

Utilizator brokensocialiconGrigoriu Cristian-Andrei brokensocialicon Data 1 octombrie 2008 20:49:54
Problema Text Scor 50
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.68 kb
#include <iostream>
#include <stdio.h>

using namespace std;

int citire()
{
    char buffer;
    bool k;
    int n,cuv=0,lungime=0;
    freopen("text.in","r",stdin);
    while (!feof(stdin))
        {
            scanf("%c",&buffer);
            n=(int)buffer;
            if ((n>=65 && n<=90) || (n>=97 && n<=122))
            {
             lungime++;
             k=true;
            }

            if (n==32 && k)
            {
              cuv++;
              k=false;
            }

        }
        cuv++;
return lungime/cuv;
}

int main()
{
    freopen ("text.out","w",stdout);
    printf ("%d",citire());
    fclose (stdout);
    return 0;
}