Cod sursa(job #2634003)

Utilizator stefan.popescuPopescu Stefan stefan.popescu Data 9 iulie 2020 15:51:23
Problema Text Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.56 kb
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
ifstream in ("text.in");
ofstream out("text.out");
char ch;
int lent=0, nrcuv=0;
bool cuvdisp=true;
int main()
{
    while(in.get(ch))
    {
        if(isalpha(ch))
        {
            lent++;
            if(cuvdisp==true)
            {
                cuvdisp=false;
                nrcuv++;
            }
        }
        else
            cuvdisp=true;
    }
    if(nrcuv==0)
    {
        out<<0;
        return 0;
    }
    out<<lent/nrcuv;
    return 0;
}