Pagini recente » Cod sursa (job #1442707) | Cod sursa (job #464662) | Cod sursa (job #485653) | Cod sursa (job #912462) | Cod sursa (job #2605373)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define max 1000010
int main() {
FILE* in = fopen("text.in", "r");
FILE* out = fopen("text.out", "w");
char* text = (char*)malloc(200000);
fgets(text, 200000, in);
int size = strlen(text);
int lWord = 0;
int lText = 0;
for(int i = 0; i < size; i++) {
if((text[i] >= 'a' && text[i] <= 'z') || (text[i] >= 'A' && text[i] <= 'Z')) {
while(text[i] != '\0' && (text[i] >= 'a' && text[i] <= 'z') || (text[i] >= 'A' && text[i] <= 'Z')) {
lWord++;
i++;
}
lText++;
}
}
fprintf(out, "%d", lWord/lText);
return 0;
}