Cod sursa(job #1041382)

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