Cod sursa(job #2476296)

Utilizator PatrickCplusplusPatrick Kristian Ondreovici PatrickCplusplus Data 18 octombrie 2019 17:00:19
Problema Text Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.75 kb
#include <bits/stdc++.h>

using namespace std;

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

string x;
long long s, c, v;

int main()
{
    while (fin >> x)
    {
        v = 0;
        for (int j = 0; j < x.size(); ++j)
        {
            if ((x[j] >= 'a' && x[j] <= 'z') || (x[j] >= 'A' && x[j] <= 'Z'))
            {
                ++s;
                v = 1;
            }
            else
            {
                if (v)
                {
                    v = 0;
                    ++c;
                }
            }
        }
        if (v)
            ++c;
    }
    if (c == 0)
    {
        fout << 0;
        return 0;
    }
    fout << s / c;
    fin.close();
    fout.close();
    return 0;
}