#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <tuple>
using namespace std;
typedef long long ll;
#define REP(i,n) for (int i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

int main ()
{
    string s;
    cin >> s;

    vector<int> ct;
    int cnt = 0;
    char c = '?';
    REP(i,s.size()) {
        if (c == '?') {
            cnt = 1;
            c = s[i];
            if (s.size() == 1) {
                ct.push_back(1);
            }
        }
        else if (c != s[i]) {
            ct.push_back(cnt);
            cnt = 1;
            c = s[i];
        } else {
            cnt++;
            if (i == s.size() - 1) {
                ct.push_back(cnt);
            }
        }
    }

    int ans = 0;
    REP(i,ct.size()) {
        int t = 1;
        while (true) {
            if ((t + 1) * t(t + 1) <= ct[i]) {
                t++;
            }
        }
        ans += t;
    }

    cout << ans << endl;

    return 0;
}
