Pagini recente » Borderou de evaluare (job #1726267) | Cod sursa (job #701646)
Cod sursa(job #701646)
#include <cstdio>
using namespace std;
const int MAXTEXT = 1100000;
char text[MAXTEXT];
int nr_cuvinte,l_cuvinte;
void citire()
{
freopen("text.in","r",stdin);
freopen("text.out","w",stdout);
gets(text);
}
void prelucrare()
{
bool cuvant = false;
for (int i = 0;text[i] != 0;++i)
if((text[i] >= 'a' && text[i] <= 'z') || (text[i] >= 'A' && text[i] <= 'Z'))
{
++l_cuvinte;
cuvant = true;
}
else if (cuvant)
{
++nr_cuvinte;
cuvant = false;
}
if (cuvant)
++nr_cuvinte;
}
int main()
{
citire();
prelucrare();
printf ("%d",l_cuvinte / nr_cuvinte);
return 0;
}