Cod sursa(job #2663639)
| Utilizator | Data | 26 octombrie 2020 22:25:09 | |
|---|---|---|---|
| Problema | Text | Scor | 10 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.41 kb |
#include <iostream>
#include <fstream>
#include <string>
int main() {
std::ifstream in("text.in");
std::ofstream out("text.out");
std::string str;
std::getline(in, str);
int words = 0, len = isalpha(str[0]);
for (int i = 1; i < (int)str.size(); ++i) {
if (isalpha(str[i]))
++len;
else if (isalpha(str[i - 1]))
++words;
}
out << len / words << '\n';
out.close();
return 0;
}
