Cod sursa(job #918451)

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

using namespace std;

char c;
long long s1, s, nrlitere;

int main ()
{
    ifstream f ("text.in");
    ofstream g ("text.out");


    while (f.get(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;
        }
    }

    g << nrlitere / s << '\n';

    return 0;
}