Cod sursa(job #859077)

Utilizator nosurrender99Bura Bogdan nosurrender99 Data 19 ianuarie 2013 17:44:50
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.49 kb
#include <fstream>
#include<cstdio>
using namespace std;
fstream  g("text.out", ios::out);

int main()
{
    freopen("text.in","r",stdin);
    long long n_cuv=0 , n_lit=0,s_lit=0;
    char a;
    while (scanf("%c",&a)>0)
    {

        if ((a>='a' && a<='z') || ( a>='A'&& a<='Z'))
            n_lit++;
        else if(n_lit)
        {
            s_lit+=n_lit;
            n_lit=0;
            n_cuv++;
        }
    }

    g<<s_lit/n_cuv;
    g.close();
    return 0;
}