Cod sursa(job #1041378)

Utilizator borcanirobertBorcani Robert borcanirobert Data 25 noiembrie 2013 19:36:59
Problema Text Scor 50
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.55 kb
#include <fstream>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int main()
{
    char c;
    long long m = 0, cuv = 0;
    while ( fin )
    {
        fin.get(c);
        while ( c == ' ' && fin ) fin >> c;
        if ( (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ) m++;
        while ( fin.get(c) && c != ' ' )
        {
            if ( (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ) m++;
        }
        cuv++;
    }
    fout << m / cuv << '\n';
    fin.close();
    fout.close();
    return 0;
}