Cod sursa(job #1257388)

Utilizator turbowin120Amarandei-Stanescu Alexandru turbowin120 Data 7 noiembrie 2014 18:28:05
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.64 kb
#include <iostream>
#include <fstream>
#include <string>
#include <ctype.h>
using namespace std;

string s;
string ::iterator i;
unsigned long long lit=0,cuv=0;
int p=0;

long long cautcuv(){
    long long sol=0;
    while(!isalpha(*i)&&i!=s.end()) i++;
    while(isalpha(*i)&&i!=s.end()) {sol++; i++;}
    return sol;
}

int main()
{
    ifstream in("text.in");
    ofstream out("text.out");
    getline(in,s,(char) 0);
    long long x;
    for(i=s.begin();i!=s.end();){
            x=cautcuv();
            if(x){
                cuv++;
            lit+=x;
            }

    }

    out<<lit/cuv;

    return 0;
}