Cod sursa(job #1560607)

Utilizator RitardoVlad Ciucescu Ritardo Data 2 ianuarie 2016 21:44:44
Problema Text Scor 90
Compilator c Status done
Runda Arhiva de probleme Marime 0.53 kb
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define ex(c) strchr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",c)

int main()
{
    FILE *in=fopen("text.in","r");
    int n=0, l=0;
    char c,cc=0;
    while ((c=fgetc(in))!=EOF)
    {
        if (ex(c)!=NULL)
            l++;
        if (!ex(c) && ex(cc))
            n++;
        cc=c;
    }
    if (ex(cc))
        n++;
    fclose(in);
    FILE *out=fopen("text.out","w");
    fprintf(out,"%d",l/n);
    fclose(out);
    return 0;
}