Pagini recente » Cod sursa (job #2831609) | Cod sursa (job #1783032) | Cod sursa (job #2292542) | Cod sursa (job #2977531) | Cod sursa (job #1059659)
#include <stdio.h>
#include <string.h>
char text[10000000];
int nr_cuvinte;
int lungime;
int isalpha(char c)
{
if ((c >= 'A') && (c <= 'Z')) return 1;
if ((c >= 'a') && (c <= 'z')) return 1;
return 0;
}
int main()
{
freopen("text.in", "r", stdin);
freopen("text.out", "w", stdout);
gets(text);
int i = 0;
while (text[i])
{
while (text[i] && !isalpha(text[i]))
{
++i;
}
while (text[i] && isalpha(text[i]))
{
++i;
++lungime;
}
if (isalpha(text[i - 1]) && !isalpha(text[i]))
++nr_cuvinte;
}
if (nr_cuvinte)
printf("%d", lungime / nr_cuvinte);
else
printf("%d", 0);
return 0;
}