Cod sursa(job #1887623)

Utilizator SburlyAndrei Florin Sburly Data 21 februarie 2017 18:15:02
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.6 kb
#include <cstdio>

using namespace std;

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

    char c;
    int s = 0;
    int n = 0;

    c = fgetc(stdin);
    while(c!='\n')
    {
        if(('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z'))
        {
            s++;
        }
        else
        {
            c = fgetc(stdin);
            if(('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z'))
                n++;
            ungetc(c, stdin);
        }

        c = fgetc(stdin);
    }
    s/=n;

    printf("%d",s);



    return 0;
}