Cod sursa(job #1478540)

Utilizator andrei20003Ionescu Andrei andrei20003 Data 28 august 2015 21:58:55
Problema Text Scor 100
Compilator c Status done
Runda Arhiva de probleme Marime 0.5 kb
#include <stdio.h>

int main()
{
    FILE *fin,*fout;
    int nrcuv, lcuv;
    char c, prevc;
    fin=fopen("text.in", "r");
    fout=fopen("text.out", "w");
    nrcuv=0;
    lcuv=0;
    while (c!=EOF){
        c=fgetc(fin);
        if (('a'<=c && c<='z') || ('A'<=c && c<='Z')){
            lcuv++;
            if (!(('a'<=prevc && prevc<='z') || ('A'<=prevc && prevc<='Z')))
                nrcuv++;
        }
        prevc=c;
    }
    fprintf(fout, "%d", lcuv/nrcuv);
    return 0;
}