Pagini recente » Cod sursa (job #2801832) | Cod sursa (job #1140541) | Cod sursa (job #691756) | Cod sursa (job #81843) | Cod sursa (job #547503)
Cod sursa(job #547503)
#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;
}