Cod sursa(job #1595276)

Utilizator SaphyrosMarcus Sergiu David Saphyros Data 10 februarie 2016 09:48:37
Problema Text Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.49 kb
#include <iostream>
#include <fstream>
#include <string>

using namespace std;

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

    int s = 0, nr = 0;
    string cuv;

    while( fin >> cuv )
    {
        if( ( !cuv.find("-") ) && ( !cuv.find("!") ) && ( !cuv.find("?") ) && ( !cuv.find(".") ) )
        {
            s = s + cuv.size();
        }
        else s = s + (cuv.size() - 1);
        nr++;
    }

    fout << s/nr;

    return 0;
}