Cod sursa(job #904565)

Utilizator gabriel93Robu Gabriel gabriel93 Data 4 martie 2013 16:30:05
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.56 kb
#include<stdio.h>
using namespace std;
int nr,l;

void rezolv()
{
    char c;
    int ok=0;
    do
    {
        scanf("%c",&c);
        if(('a'<=c && c<='z') || ('A'<=c && c<='Z'))
        {
            ++l;
            ok=1;
        }
        if(ok==1 && (c==' ' || c=='-'))
        {
            ++nr;
            ok=0;
        }
    }while(c!='\n');
    printf("%d",l/(nr+1));
}

int main()
{
    freopen("text.in","r",stdin);
    freopen("text.out","w",stdout);
    rezolv();
    fclose(stdin);
    fclose(stdout);
    return 0;
}