Cod sursa(job #918436)

Utilizator Theodor1000Cristea Theodor Stefan Theodor1000 Data 18 martie 2013 21:14:29
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.49 kb
#include <cstdio>

using namespace std;

char c;
int s1, s, nrlitere;

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


    while (scanf ("%c", &c))
    {
        if (int (c) == 10) break;

        if ((c >= 'a' && c <= 'z')||(c >= 'A' && c <= 'Z')) s1++;

        else
        {
            if (s1 != 0) s++;
            nrlitere += s1;
            s1 = 0;
        }
    }

    printf ("%d\n", nrlitere / s);

    return 0;
}