Cod sursa(job #634045)

Utilizator cristianalex81Cristian Alexandru cristianalex81 Data 15 noiembrie 2011 16:14:29
Problema Text Scor 90
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.54 kb
#include <stdio.h>

using namespace std;

int main()
{
    int wordc=0, charc=0;
    bool last=false;
    char x;
    freopen("text.in","r",stdin);
    freopen("text.out","w",stdout);
    while (scanf("%c",&x)==1)
    {
        if ((x>='A')&&(x<='z'))
        {
            if (last == false)
                wordc ++;
            charc ++;
            last = true;
        }
        else
        {
            last = false;
        }
    }
    if (last==true)//one more word
        wordc ++;
    printf("%d",(int)(charc/wordc));
    return 0;
}