Cod sursa(job #2326447)

Utilizator hoprixVlad Opris hoprix Data 23 ianuarie 2019 15:55:13
Problema Text Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.46 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
char x;
int nr_lit, nr_cuv;
bool ok;
bool litera(char x)
{
    return (x >= 'a' && x <= 'z' || x >= 'A' && x <= 'Z');
}
int main()
{
    while(fin.get(x))
    {
        if(litera(x))
        {
            if(!ok)nr_cuv++;
            nr_lit++;
            ok = 1;
        }
        else ok = 0;
    }
    fout << nr_lit / nr_cuv;
}