Cod sursa(job #1097164)

Utilizator NaniteNanite Nanite Data 3 februarie 2014 03:33:07
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.52 kb
#include <cstdio>
#include <cctype>
#include <cstring>

using namespace std;

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

    char c;
    int l = 0, nw = 0;
    bool w = false;

    while(true) {
        if(scanf("%c", &c) == EOF) {
            break;
        } else if(isalpha(c)) {
            if(!w) {
                nw++;
                w = true;
            }
            l++;
        } else if(w) {
            w = false;
        }
    }
    printf("%i", l/nw);

    return 0;
}