Cod sursa(job #1159246)

Utilizator G_DavidGherghita David G_David Data 29 martie 2014 14:11:36
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.56 kb
#include <fstream>
using namespace std;

int main()
{
    int len, i, l = 0, n = 0;
    string str;

    ifstream infile;
    infile.open("text.in");
    ofstream outfile;
    outfile.open("text.out");

    getline(infile, str);
    len = str.length();

    for (i = 1; i < len - 1; i += 1)
    {
        if (!(isalpha(str[i])) && isalpha(str[i + 1]))
        {
            n++;
        }
        if (isalpha(str[i]))
        {
            l++;
        }
    }

    outfile << l / n;

    infile.close();
    outfile.close();

    return 0;
}