Cod sursa(job #989043)

Utilizator florin.elfusFlorin Elfus florin.elfus Data 24 august 2013 18:29:50
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.44 kb
#include <stdio.h>
#include <ctype.h>

int main()
{
    int words = 0, let = 0;
    char ch;
    bool isWord = false;

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

    while (scanf("%c", &ch) != EOF)
    {
        if (isalpha(ch))
            let ++, isWord = true;
        else
            if (isWord)
                words ++, isWord = false;
    }

    printf("%d", let / words);
    return 0;
}