Cod sursa(job #2095058)

Utilizator haruuLucian haruu Data 26 decembrie 2017 21:08:52
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.59 kb
#include <fstream>
#include <iostream>
#include <string>
using namespace std;

ifstream is("text.in");
ofstream os("text.out");

int suma_litere = 0;
string str;

int main()
{
    int i = 0;
    while(is >> str)
    {
        int aux = suma_litere;
        for(int j = 0; j <= str.length(); ++j)
        {
            if(isalpha(str[j]))
                suma_litere++;
            if(isalpha(str[j-1]) && !isalpha(str[j]))
                i++;
        }
    }
    cout << suma_litere << ' ' << i;
    os << suma_litere / i;
    is.close();
    os.close();
    return 0;
}