Cod sursa(job #2212636)

Utilizator TudorP2006Popescu Tudor TudorP2006 Data 14 iunie 2018 15:48:28
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.57 kb
#include <fstream>

using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int main()
{
    int cnt = 0, ok = 0, cuvinte = 0;
    char a;
    while (fin >> noskipws >> a)
    {
        if ((a >= 'A' && a <= 'Z') || (a >= 'a' && a <= 'z'))
        {
            cnt++;
            ok = 1;
        }
        else
        {
            if (ok == 1)
            {
                cuvinte++;
                ok = 0;
            }
        }
    }
    if (ok == 1)
    {
        cuvinte++;
    }
    fout << cnt / cuvinte;
    return 0;
}