Cod sursa(job #604211)

Utilizator a_h1926Heidelbacher Andrei a_h1926 Data 20 iulie 2011 21:55:00
Problema Text Scor 90
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.7 kb
#include <iostream>

using namespace std;

long long L, NWords;

void Read ()
{
    freopen ("text.in", "r", stdin);
    char A, B='\0';
    scanf ("%c", &A);
    while (scanf ("%c", &B)!=EOF)
    {
        if ((A>='a' and A<='z') or (A>='A' and A<='Z'))
        {
            ++L;
            if ((B>='a' and B<='z') or (B>='A' and B<='Z'));
            else
            {
                ++NWords;
            }
        }
        A=B;
    }
}

void Print ()
{
    freopen ("text.out", "w", stdout);
    if (NWords!=0)
    {
        printf ("%lld\n", L/NWords);
    }
    else
    {
        printf ("0\n");
    }
}

int main()
{
    Read ();
    Print ();
    return 0;
}