Cod sursa(job #1453475)

Utilizator DrumeaVDrumea Vasile DrumeaV Data 23 iunie 2015 17:13:16
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.48 kb
#include <fstream>
using namespace std;

ifstream fin("text.in");
ofstream fout("text.out");

char C;
int Lenght,Nr,X;

inline bool Letter(char C)
{
    return ((C >= 'a' && C <= 'z') || (C >= 'A' && C <= 'Z'));
}

int main()
{
    while(fin.get(C))
    {
        if (Letter(C))
            X++;
        else
        {
            Lenght += X;
            if (X > 0) Nr++;
            X = 0;
        }
    }

    fout << (Lenght / Nr);

   return 0;
}