Cod sursa(job #470047)

Utilizator palcuiealexAlex Palcuie palcuiealex Data 11 iulie 2010 00:37:38
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.7 kb
#include <cstdio>
#include <iostream>

using namespace std;

bool iflit(char c)
{
    if (('a'<=c && c<='z') || ('A'<=c && c<='Z'))
        return true;
    return false;
}

int main()
{
    freopen("text.in","r",stdin);
    freopen("text.out","w",stdout);

    bool cuvant=false;
    char c;
    int nrCuvinte=0,lg=0,nrLit=0;

    while(!feof(stdin))
    {
        scanf("%c",&c);
        bool lit=iflit(c);
        if (lit) ++nrLit;
        if (lit && !cuvant)
        {
            ++nrCuvinte;
            cuvant=true;
            lg=0;
        }
        else if (!lit && cuvant)
        {
            cuvant=false;
        }
    }
    cout<<nrLit/nrCuvinte;
    return 0;
}