Cod sursa(job #2632213)

Utilizator NicolaalexandraNicola Alexandra Mihaela Nicolaalexandra Data 2 iulie 2020 16:00:50
Problema Text Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.54 kb
#include <bits/stdc++.h>
#define DIM 2000010
using namespace std;
char ch;
int n,i,nr_cuv,lg,ok;

int litera (char c){
    if ( (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
        return 1;
    return 0;
}

int main (){

    ifstream fin ("text.in");
    ofstream fout ("text.out");

    while (fin.get(ch)){

        if (litera(ch)){
            lg++;
            if (!ok){
                ok = 1;
                nr_cuv++;
            }
        } else ok = 0;

    }

    fout<<lg / nr_cuv;

    return 0;
}