Cod sursa(job #2706698)

Utilizator costeoTeodoru Cosmin costeo Data 15 februarie 2021 17:30:23
Problema Text Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.54 kb
#include<iostream>
#include<fstream>
#include<cstring>
using namespace std;
int main()
{
    char c;
    ifstream fin("text.in");
    ofstream fout("text.out");
    long long int cnt = 0, s = 0, nr = 0;
    while(fin.get(c))
    {
        if(c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z')
        {
            cnt++;
        }
        else
        {
            if(cnt)
            {
                nr++;
                s += cnt;
            }
            cnt = 0;
        }
    }
    fout << s / nr;
    return 0;
}