Cod sursa(job #485102)

Utilizator cezar.elnazlicreeps cezar.elnazli Data 17 septembrie 2010 02:29:31
Problema Text Scor 100
Compilator c Status done
Runda Arhiva de probleme Marime 0.43 kb
#include <stdio.h>
#include <ctype.h>

int main(void) {

    int ch, nr_lit = 0, nr_cuv = 0, i = 0;

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

    while((ch = getchar()) != EOF) {

        if(isalpha(ch)) {

            ++nr_lit;
            if(!i) {
                ++nr_cuv;
                i = 1;
            }
        } else
            i = 0;
    }

    printf("%d\n", nr_lit / nr_cuv);

    return 0;
}