Cod sursa(job #890015)

Utilizator raulmuresanRaul Muresan raulmuresan Data 24 februarie 2013 20:14:36
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.69 kb
#include <cstdio>
#include <cstring>
#include <cctype>

using namespace std;
int i,aux,n,b,k,j,p,m,s,pas,l,cuv,litere,ok;
char text[2000000];

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

    gets(text);
    //printf("%s\n",text);
    pas=0;
    l=strlen(text);
    while(!(isalpha(text[pas])))
    {
        pas++;
    }
    //printf("%d",pas);
    while(pas<l)
    {
        ok=0;
        while(isalpha(text[pas]))
        {
            litere++;
            pas++;
            ok=1;
        }
        if(ok==1)
        {
            cuv++;
        }
        else
        pas++;
    }
    printf("%d\n",litere/cuv);

}