Cod sursa(job #1604899)

Utilizator doroftei1999Doroftei Andrei doroftei1999 Data 18 februarie 2016 17:44:36
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.47 kb
#include <iostream>
#include <fstream>
#include <cstring>

using namespace std;

ifstream in("text.in");
ofstream out("text.out");
int main()
{
    char x;
    int cuvinte = 0, litere = 0, length = 0;
    while(in >> noskipws >> x)
    {
        if(isalpha(x))
            length++;
        else if(length)
        {
            litere += length;
            length = 0;
            cuvinte ++;
        }
    }
    out << litere / cuvinte;
    return 0;
}