Cod sursa(job #2095044)
| Utilizator | Data | 26 decembrie 2017 20:57:42 | |
|---|---|---|---|
| Problema | Text | Scor | 90 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.64 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]) && isalpha(str[j+1]))
i++;
}
if(aux != suma_litere)
i++;
}
//cout << suma_litere << ' ' << i;
os << suma_litere / i;
is.close();
os.close();
return 0;
}
