Cod sursa(job #2680802)
Utilizator | David Curca divadd | Data | 4 decembrie 2020 13:39:29 |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.63 kb |
#include <fstream>
#include <iostream>
using namespace std;
char c;
string s;
int 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++;
}else{
if(lcuv != 0){
nrcuv++;
}
lcuv = 0;
}
}
if(ltotal == 0){
fout << "0\n";
return 0;
}
fout << ltotal/nrcuv << "\n";
return 0;
}