Cod sursa(job #863606)

Utilizator stoicatheoFlirk Navok stoicatheo Data 23 ianuarie 2013 22:25:47
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.46 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;
}