Cod sursa(job #1059701)
| Utilizator | Data | 16 decembrie 2013 21:32:06 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | c | Status | done |
| Runda | Arhiva de probleme | Marime | 0.52 kb |
#include <stdio.h>
#include <string.h>
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);
char a, b;
a = b = ' ';
while (scanf("%c", &a) != EOF)
{
if (isalpha(a))
{
++lungime;
if (!isalpha(b))
++nr_cuvinte;
}
b = a;
}
printf("%d", (nr_cuvinte ? (lungime / nr_cuvinte) : 0));
return 0;
}