Cod sursa(job #1785793)

Utilizator CrystyAngelDinu Cristian CrystyAngel Data 21 octombrie 2016 23:00:50
Problema Text Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.61 kb
#include <iostream>
#include <fstream>
#include <cstring>

using namespace std;

ifstream fin("text.in");
ofstream fout("text.out");

char c;
long long n,i;

int main()
{
    long long suma=0;
    long long nr=0;
    int ok;
    fin>>c;
    while(!fin.eof())
    {
        if((c>='a' && c<='z') || (c>='A' && c<='Z'))
        {
            ++suma;
            ok=1;
        }
        else
        {
            if(ok)
            {
                nr++;
                ok=0;
            }
        }
        fin>>c;
    }
    if(nr)
        fout<<suma/nr;
    else
        fout<<0;
}