Cod sursa(job #1342710)

Utilizator tudor1Craciunas Tudor tudor1 Data 14 februarie 2015 14:02:56
Problema Text Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.43 kb
#include <iostream>
#include <fstream>
#include <string>

using namespace std;
string s;
int nr,nrc;

int main()
{
    ifstream f ("text.in");
    ofstream g ("text.out");
    getline (f, s);
    for (int i=0;i<s.length();i++)
    {
        if (isalpha(s[i]))
            nr++;
        if ((s[i]==' ' || s[i]=='-') && i!=0)
            nrc++;
    }
    if (nrc==0)
        g<<"0";
    g<<nr/nrc;
    return 0;
}