Cod sursa(job #2451916)

Utilizator pregoliStana Andrei pregoli Data 28 august 2019 19:14:09
Problema Text Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.54 kb
#include <bits/stdc++.h>
using namespace std;

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

int nr, let;

void getsol()
{
    char c;
    char lastChar = 0;
    while (fin >> noskipws >> c)
    {

        if (isalpha(c))
            let++;
        if (lastChar != 0)
        {
            if (!isalpha(c) && isalpha(lastChar))
                nr++;
        }
        lastChar = c;
    }
}
int main()
{
    char s[100];
    getsol();
    fout << let / nr;
    fin.close();
    fout.close();
    return 0;
}