Cod sursa(job #2641926)

Utilizator Tache_RoxanaTache Roxana Tache_Roxana Data 13 august 2020 08:24:27
Problema Text Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.47 kb

#include <fstream>
using namespace std;
ifstream cin("text.in");
ofstream cout("text.out");
char ch;
int main()
{
    int nr=0,lung=0,ok=0;
    while(cin.get(ch))
    {
        if((ch>='a' and ch<='z') or (ch>='A' and ch<='Z'))
        {
            if(ok==0)
            {
                ++nr;
                ok=1;
            }
            ++lung;
        }
        else ok=0;
    }
    if(nr==0) cout<<0;
    else cout<<lung/nr;
    return 0;
}