Cod sursa(job #2020793)

Utilizator UWantMyNameGheorghe Vlad Camil UWantMyName Data 11 septembrie 2017 18:12:03
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.63 kb
#include <bits/stdc++.h>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");

inline bool Litera(char ch)
{
    if ('a'<=ch && ch<='z') return true;
    if ('A'<=ch && ch<='Z') return true;
    return false;
}

int main()
{
    char ch;
    int lgmax,nrcuv;
    bool cuvant;
    lgmax=nrcuv=0;
    while(fin.get(ch))
    {
        if (Litera(ch))
        {
            lgmax++;
            cuvant=true;
        }
        else
        {
            if (cuvant) nrcuv++;
            cuvant=false;
        }
    }
    fout<<lgmax/nrcuv<<"\n";
    fin.close();
    fout.close();
    return 0;
}