#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
string ss(string s) {
  int l = s.length();
  string T = "";
  for (int(i) = 0; (i) < (l); (i)++) {
    if (i < l - 1 && s[i] != s[i + 1])
      i++;
    else
      T += s[i];
  }
  return s == T ? T : ss(T);
}
int main() {
  string S;
  cin >> S;
  ll l = S.length();
  string T = ss(S);
  cout << (S.length() - T.length()) / 2 << '\n';
  return 0;
}
