Cod sursa(job #2344235)
Utilizator | Data | 14 februarie 2019 21:36:05 | |
---|---|---|---|
Problema | Text | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.51 kb |
#include <fstream>
#include <cctype>
using namespace std;
int main()
{
ifstream input("text.in");
int words = 0, len = 0;
char c;
bool ok = true;
while(input.get(c))
{
if (isalpha(c))
{
if(!ok)
words++;
len++;
ok = false;
} else ok = true;
}
int result = 0;
if (words)
result = len / words;
ofstream output("text.out");
output << result;
return 0;
}