Cod sursa(job #2081530)

Utilizator ruxi.icleanuRuxandra Icleanu ruxi.icleanu Data 4 decembrie 2017 19:56:13
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.63 kb
#include <bits/stdc++.h>

using namespace std;

FILE *fi, *fo;

int rt() {
    long long nrcuv, lt, l;
    char ch;
    nrcuv=lt=0;
    ch=fgetc(fi);
    while(ch!=EOF) {
        while((ch<='a' || ch>='z') && (ch<='A' || ch>='Z') && ch!=EOF)
            ch=fgetc(fi);
        l=0;
        while((ch>='a' && ch<='z') || (ch>='A' && ch<='Z')) {
            ch=fgetc(fi);
            l++;
        }
        nrcuv++;
        lt+=l;
    }
    return lt/nrcuv;
}

int main()
{
    fi = fopen("text.in", "r");
    fo = fopen("text.out", "w");
    fprintf(fo, "%d", rt());
    fclose(fi);
    fclose(fo);
    return 0;
}