Cod sursa(job #1358302)

Utilizator CourageAntal Alexandru Courage Data 24 februarie 2015 15:30:54
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.62 kb
#include <cstdio>
#include <cstring>
using namespace std;

int main(void)
{
    freopen("text.in", "r", stdin);
    freopen("text.out", "w", stdout);
    int long long numar_litere = 0, numar_cuvinte = 0, k = 0;
    char c;
    while(scanf("%c", &c) != EOF)
    {
        if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'))
        {
            ++numar_litere;
            if (k == 0)
            {
                ++numar_cuvinte;
            }
            k = 1;
        }
        else
        {
            k = 0;
        }
    }
    printf("%d", numar_litere / numar_cuvinte);
    return 0;

}