Cod sursa(job #2473861)

Utilizator vladbatalanBatalan Vlad vladbatalan Data 14 octombrie 2019 13:37:56
Problema Text Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.75 kb
#include <bits/stdc++.h>
#define LL long long

using namespace std;

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

string s;
int nrcuv, lungcuv, sz;
bool isword;


int main()
{
    while(fin >> s)
    {
        sz = s.size();
        isword = 0;
        for(int i=0; i < sz; ++i)
        {
            if((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z'))
            {
                lungcuv ++;
                ///este litera
                if(!isword)
                {
                    nrcuv ++;
                    isword = 1;
                }
            }
            else
            {
                isword = 0;
            }
        }
    }
    fout << lungcuv/nrcuv << '\n';
    return 0;
}