Cod sursa(job #603397)

Utilizator andrianAndrian andrian Data 15 iulie 2011 21:25:48
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.4 kb
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
    ifstream in("text.in");
    char c;
    int k=0, l=0;
    bool ok=false, ok1=false;
    for(;in && !in.eof() && in >> noskipws >> c;)
    {
        if(isalpha(c)) ++l, ok=true;
        else ok=false;
        if(ok != ok1 && ok) ++k;
        ok1 = ok;
    }
    ofstream out("text.out");
    out << (l/k);
    return 0;
}