Cod sursa(job #1494828)

Utilizator sabauandrei98Sabau Andrei sabauandrei98 Data 1 octombrie 2015 21:35:49
Problema Text Scor 70
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.85 kb
#include <iostream>
#include <limits.h>
#include <cmath>
#include <string>
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <vector>
#include <stack>
#include <map>
#include <fstream>
#include <list>
#include <queue>
#include <iomanip>
#include <deque>
#include <set>

using namespace std;

ifstream f("text.in");
ofstream g("text.out");

string s;

int main()
{
    int x = 0;
    int cuvinte = 0;
    int litere = 0;

    while(!f.eof())
    {
        f >> s;
        s[s.size()] = '-';

        for(int i = 0; i <= s.size(); i++)
            if (isalpha(s[i]))
                    x ++;
            else
            {
                litere += x;
                if (x >= 1)
                    cuvinte ++;

                x = 0;
            }
    }
    g << litere/cuvinte;

    return 0;
}