Cod sursa(job #547503)
| Utilizator | Data | 6 martie 2011 13:48:09 | |
|---|---|---|---|
| Problema | Text | Scor | 0 |
| Compilator | c | Status | done |
| Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <stdio.h>
#include <ctype.h>
#define IN "text.in"
#define OUT "text.out"
int main(void) {
long len_text = 0, nr_cuv = 0, cuv = 0;
char ch;
freopen(IN, "r", stdin);
freopen(OUT, "w", stdout);
while((ch = getchar()) != EOF) {
if(!ok && isalpha(ch)) ++nr_cuv, ok = 1, ++len_text;
else if(ok && isalpha(ch)) ++len_text;
else if(ok && !isalpha(ch)) ok = 0;
}
printf("%ld", len_text / nr_cuv);
return 0;
}
