Cod sursa(job #1403361)

Utilizator alittlezzCazaciuc Valentin alittlezz Data 27 martie 2015 11:17:36
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.53 kb
#include <fstream>
#include <cstring>

using namespace std;

char v[10];

int main(){
    int k,c,s;
    ifstream f("text.in");
    ofstream g("text.out");
    k = 0;
    c = 0;
    s = 0;
    while(!f.eof()){
        f >> noskipws >> v[0];
        if((v[0] >= 65 && v[0] <= 90) || (v[0] >= 97 && v[0] <= 122)){
            k++;
            c++;
        }else{
            s = s + k;
            if(k > 0){
                c = c - (k-1);
            }
            k = 0;
        }
    }
    g<<s/c;
    return 0;
}