Cod sursa(job #2684928)

Utilizator RaresPoinaruPoinaru-Rares-Aurel RaresPoinaru Data 15 decembrie 2020 10:53:42
Problema Text Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.57 kb
#include <fstream>
#include <ctype.h>
using namespace std;
ifstream fin ("text.in");
ofstream fout ("text.out");
int main()
{
    char ch;
    int l,cv,lt;
    l=0;
    lt=0;
    cv=0;
    while (fin.get (ch))
    {
        if (isalpha (ch))
        {
            l++;
            lt++;
        }
        else
        {
            if (l>=1)
            {
                cv++;
                l=0;
            }
        }
    }
    if (cv==0)
        fout <<0;
    else
        fout <<lt/cv;
    fin.close ();
    fout.close ();
    return 0;
}