Cod sursa(job #485100)

Utilizator cezar.elnazlicreeps cezar.elnazli Data 17 septembrie 2010 02:25:38
Problema Text Scor 50
Compilator c Status done
Runda Arhiva de probleme Marime 0.41 kb
#include <stdio.h>
#include <ctype.h>

int main(void) {

    int ch, nr_lit = 0, nr_cuv = 1, 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;
}