Cod sursa(job #2218167)

Utilizator ciucacosmin109Ciuca Cosmin ciucacosmin109 Data 3 iulie 2018 15:10:35
Problema Text Scor 70
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.68 kb
#include<iostream>
#include<fstream>
#include<string.h>
using namespace std;

int main()
{   ifstream f("text.in");
    ofstream g("text.out");
    char s[1000002];
    long double l=0,nr=0;
    bool iuytresxcvbhju =0;

    while(!f.eof()){
        f.getline(s,1000000);
            for(int i=0;s[i];i++){
            if(isalpha(s[i])){
                l++;
                iuytresxcvbhju=1;
            }
            else if(iuytresxcvbhju){// daca precedentul a fost litera
                iuytresxcvbhju=0;
                nr++;
            }
        }
    }

    if(iuytresxcvbhju) nr++;

    if(nr!=0)g<<l/nr<<endl;
    else g<<0;
    f.close();
    g.close();
}