Cod sursa(job #2437082)
Utilizator | Data | 8 iulie 2019 13:31:16 | |
---|---|---|---|
Problema | Text | Scor | 90 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.48 kb |
#include <fstream>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int main() {
unsigned int wordCounter = 0, letterCounter = 0;
bool state;
char c;
while (fin.get(c)) {
if (isalpha(c)) {
letterCounter++;
state = true;
}
else {
if (state)
wordCounter++;
state = false;
}
}
fout << letterCounter / wordCounter;
}