Cod sursa(job #2173149)

Utilizator tangerine515Alex Anton tangerine515 Data 15 martie 2018 20:55:01
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.46 kb
#include <bits/stdc++.h>
#include <cassert>

using namespace std;

fstream f("text.in", ios::in);
fstream g("text.out", ios::out);

int main(void)
{
    uint16_t wcount = 0, wlett = 0;
    string text, buf;
    assert(getline(f, text));
    stringstream ss(text);

    while(ss >> buf)
    {
        wcount++;
        for(int i = 0; i < buf.length(); i++)
            if(isalpha(buf[i])) wlett++;
    }

    assert(g << (uint16_t) wlett / wcount);

    return EXIT_SUCCESS;
}