Cod sursa(job #2593051)

Utilizator cyg_vladioanBirsan Vlad cyg_vladioan Data 2 aprilie 2020 19:49:01
Problema Text Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.5 kb
#include <cstdio>
#include <cctype>
using namespace std;
int main()
{
    freopen("text.in" , "r" , stdin);
    freopen("text.out" , "w" , stdout);
    short int nrl , nrc;
    char ch1 , ch2;
    ch1 = NULL;
    nrl = nrc = 0;
    while(scanf("%c" , &ch2) != EOF)
    {
        if(isalpha(ch2))
            nrl ++;
        if(!isalpha(ch2) && isalpha(ch1))
            nrc ++;
        ch1 = ch2;
    }
    if(isalpha(ch2))
        nrc ++;
    printf("%hd\n" , nrl / nrc);
    return 0;
}