Cod sursa(job #1739317)

Utilizator vladrochianVlad Rochian vladrochian Data 9 august 2016 11:24:43
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.61 kb
#include <fstream>
#include <cstring>
#include <cassert>

using namespace std;

const int LEN = 2000000;

ifstream fin("text.in");
ofstream fout("text.out");

char a[LEN];

bool Litera(char p)
{
    return ((p >= 'A' and p <= 'Z') or (p >= 'a' and p <= 'z'));
}

int main()
{
    fin.getline(a, LEN);
    int n = strlen(a);
    assert(n > 0 && n <= 1100000);
    int x = 0, y = 0;
    for (int i = 0; i < n; i++) {
        if (Litera(a[i]))
        {
            x++;
            if (not Litera(a[i + 1]))
                y++;
        }
      }
    fout << x / y << '\n';
    return 0;
}