Cod sursa(job #3042013)

Utilizator MihneaLoxGheorghe Mihnea Florentin MihneaLox Data 3 aprilie 2023 15:45:41
Problema Text Scor 50
Compilator c-64 Status done
Runda Arhiva de probleme Marime 0.42 kb
#include <stdio.h>
#include <ctype.h>

int main(void){

    FILE* fin = fopen("text.in","r");
    FILE* fout = fopen("text.out","w");

    char c,last_c='.';
    int lenght=0,num_cuv;
    while((c=getc(fin))!=EOF){
        if(isalpha(c))lenght++;
        else if(isalpha(last_c))num_cuv++;
        last_c=c;
    }

    fprintf(fout,"%d",lenght/num_cuv);

    fclose(fin);
    fclose(fout);

    return 0;
}