Cod sursa(job #1673884)

Utilizator silkMarin Dragos silk Data 4 aprilie 2016 10:41:54
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.54 kb
#include <cstdio>

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

char c;
int ok=0,nrcuv=0,litere=0;

    while( scanf("%c",&c) && !feof(stdin) )
    {
        if( (c>='a' && c<='z') || (c>='A' && c<='Z') )
        {
            litere++;
            ok = 1;
        }

        else{
            if(ok) nrcuv++;
            ok = 0;
        }
    }
        if(ok) nrcuv++;


        if(nrcuv)
            printf("%d\n",litere/nrcuv);
        else
            printf("0\n");


return 0;
}