Cod sursa(job #1115546)

Utilizator catalincraciunCraciun Catalin catalincraciun Data 21 februarie 2014 21:38:02
Problema Text Scor 60
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.69 kb
/// Craciun Catalin
///  Text
///   www.infoarena.ro/problema/text
#include <fstream>
#include <iostream>
#include <cstring>

#define NMax 1000000

using namespace std;

ifstream f("text.in");
ofstream g("text.out");

long cuv=0;
long lit=0;
bool toAdd;

void solve()
{
    while (!f.eof())
    {
        char c;
        f>>noskipws>>c;

        if (c>='a' && c<='z')
        {
            lit++;
            if (toAdd)
            {
                cuv++;
                toAdd=false;
            }
        }
        else
            toAdd=true;
    }

    g<<lit/cuv<<'\n';
    g.close();
}

int main()
{
    toAdd=true;
    solve();

    return 0;
}