Pagini recente » Autentificare | Cod sursa (job #188876) | Clasament Grigore Mosil 2016 Clasa a 9-a | monthly1 | Cod sursa (job #1402040)
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
string v;
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();
for (int i=0; i<v.size(); i++) {
if (isLetter(x) && !isLetter(lastLetter)) words++;
if (isLetter(x)) letters++;
lastLetter = x;
}
}
g<<letters/words<<"\n";
return 0;
}