Cod sursa(job #1948899)

Utilizator ionutpop118Pop Ioan Cristian ionutpop118 Data 1 aprilie 2017 16:07:59
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.59 kb
#include <cstdio>
#include <cstring>
#include <cctype>
using namespace std;

int main()
{
    freopen("text.in", "r", stdin);
    freopen("text.out", "w", stdout);
    int nrl = 0, nrc = 0, nr;
    char ch;
    ch = getchar();
    while (ch != EOF)
    {
        if (isalpha(ch))
            ++nrl, ++nr;
        else
        {
            if (nr > 0)
                ++nrc;
            nr = 0;
        }
        ch = getchar();
    }
    if (nr > 0)
        ++nrc;

    if (nrc > 0)
        printf("%d\n", nrl / nrc);
    else
        printf("0\n");
    return 0;
}