Cod sursa(job #2757129)

Utilizator 100pCiornei Stefan 100p Data 3 iunie 2021 23:36:15
Problema Text Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.73 kb
#include <bits/stdc++.h>
#define FILES freopen("text.in","r",stdin);\
              freopen("text.out","w",stdout);
#define fastio std::ios_base::sync_with_stdio(NULL),cin.tie(NULL),cout.tie(NULL);
using namespace std;
char c;
int lgcv,cv;
bool ok;
string a;
bool gd(char c)
{
    return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
}
int main()
{
    fastio
    FILES
    getline(cin,a);
    for(int i = 0;i<a.size();++i)
    {
        if(gd(a[i]))
        {
            while(i < a.size() && (gd(a[i]) || a[i] != ' '))
            {
                if(gd(a[i])) lgcv++;
                if(a[i] == '-') cv++;
                i++;
            }

            cv++;
        }
    }
    cout << lgcv/cv;
}