Cod sursa(job #2680806)

Utilizator divaddDavid Curca divadd Data 4 decembrie 2020 13:52:53
Problema Text Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.7 kb
#include <fstream>
#include <iostream>
using namespace std;
long long c;
string s;
long long ltotal,nrcuv,lcuv;

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

int main()
{
    getline(fin, s);
    for(string::iterator it = s.begin(); it != s.end(); it++){
        c = *it;
        if((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')){
            ltotal++;
            lcuv++;
            cout << (char)c;
        }else{
            if(lcuv != 0){
                nrcuv++;
                cout << "\n";
            }
            lcuv = 0;
        }
    }
    if(nrcuv == 0){
        fout << "0\n";
        return 0;
    }
    fout << ltotal/nrcuv << "\n";
    return 0;
}