Pagini recente » Cod sursa (job #1939690) | Cod sursa (job #323110) | Cod sursa (job #1107282) | Cod sursa (job #1611711) | Cod sursa (job #1093647)
#include <cstdio>
using namespace std;
inline bool is_letter(char x);
// const bool debug = true;
int main(int argc, char *argv[])
{
freopen("text.in", "r", stdin);
freopen("text.out", "w", stdout);
int word_count = 0;
int letter_count = 0;
char tmp;
bool in_word = false;
while (!feof(stdin)) {
scanf("%c", &tmp);
if (!is_letter(tmp)) {
in_word = false;
continue;
}
else {
letter_count++;
if (!in_word) {
in_word = true;
word_count++;
}
}
}
printf("%d\n", letter_count / word_count);
return 0;
}
inline bool is_letter(char x)
{
return (x >= 'a' && x <= 'z') || (x >= 'A' && x <= 'Z') ? true : false;
}