Cod sursa(job #1692348)

Utilizator UnrealHerodsfg asdfgsa awet UnrealHero Data 20 aprilie 2016 18:45:52
Problema Text Scor 90
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.53 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");

int main(){
    char c;long long tot=0,cuv=0,nr=0; bool ok=true;
    while(!f.eof()){
    f>>noskipws>>c;
    if(ok){
        if((c>='a' && c<='z') || (c>='A' && c<='Z'))
        cuv++;
        else {
        tot+=cuv;cuv=0;nr++; ok=false;
        }
    }else{
        if((c>='a' && c<='z') || (c>='A' && c<='Z')){cuv++;ok=true;}
    }
    }
    g<< tot/nr;


    f.close();
    g.close();
    return 0;
}