Cod sursa(job #1402044)
| Utilizator | Data | 26 martie 2015 11:53:08 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.48 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int letters, words, lastLetter = '#';
bool isLetter(char x) {
return ('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z');
}
int main()
{
while(!f.eof()) {
char x = f.get();
if (isLetter(x) && !isLetter(lastLetter)) words++;
if (isLetter(x)) letters++;
lastLetter = x;
}
g<<letters/words<<"\n";
return 0;
}
