Cod sursa(job #1064962)

Utilizator G_DavidGherghita David G_David Data 22 decembrie 2013 15:51:08
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.62 kb
#include <iostream>
#include <string>
#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() - 1;
    for (i = 0; i <= len; i += 1) {
        if (isalpha(str[i])) {
            l++;
            if (!(isalpha(str[i + 1]))) {
                n++;
            }
        }
    }

    outfile << l / n;

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

    cout << l << endl;
    cout << n;

    return 0;
}