Cod sursa(job #2961573)

Utilizator Samoila_AlexandruSamoilaAlexandru Samoila_Alexandru Data 6 ianuarie 2023 18:35:24
Problema Text Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.59 kb
#include <fstream>
#include <iostream>

using namespace std;

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

char ch;
long long l, ltotal, nrCuvinte;

int main()
{
    ios_base::sync_with_stdio(false);
    fin.tie(0);

    while(!fin.eof())
    {
        fin>>noskipws>>ch;
        if((ch>='a' && ch<='z') || (ch>='A' && ch<='Z'))
            l++;
        else
        {
            ltotal+=l;

            if(l>0)
                nrCuvinte++;

            l=0;
        }
    }

    fin.close();

    fout<<ltotal/nrCuvinte;

    fout.close();

    return 0;
}