Pagini recente » Cod sursa (job #3240288) | Cod sursa (job #1164756) | Cod sursa (job #14563) | Cod sursa (job #1917519) | Cod sursa (job #826429)
Cod sursa(job #826429)
#include <stdio.h>
using namespace std;
bool is_alpha( char c )
{
return 'a' <= c && c <= 'z' ||
'A' <= c && c <= 'Z';
}
int main()
{
freopen( "text.in", "r", stdin );
freopen( "text.out", "w", stdout );
int word_count = 0;
int total_word_size = 0;
bool inside_word = false;
char c;
while( scanf( "%c", &c ) == 1 )
{
if( is_alpha(c) )
{
inside_word = true;
total_word_size += 1;
}
else
{
if( inside_word )
{
inside_word = false;
word_count += 1;
}
}
}
printf( "%d", total_word_size / word_count );
return 0;
}