Pagini recente » Cod sursa (job #68009) | Cod sursa (job #805750) | Cod sursa (job #582488) | Cod sursa (job #563650) | Cod sursa (job #2455695)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
bool test(char c)
{
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
}
int main()
{
char c;
int words, chars;
bool word = false;
words = chars = 0;
while(!fin.eof()){
c = fin.get();
if(test(c)){
chars++;
word = true;
}else if(word){
words++;
word = false;
}
}
//cout << words << " " << chars;
fout << chars / words;
return 0;
}