Cod sursa(job #634046)

Utilizator cristianalex81Cristian Alexandru cristianalex81 Data 15 noiembrie 2011 16:18:27
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.57 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'))||((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;
}