#include <bits/stdc++.h>
template <typename T>
T gcd(T a, T b) {
  return b == 0 ? a : gcd(b, a % b);
}
template <typename T>
T lcm(T a, T b) {
  return a * b / gcd(a, b);
}
template <typename T>
T clamp(T val, T min, T max) {
  return val < min ? min : (max < val ? max : val);
}
template <typename T>
size_t max_index(T begin, T end) {
  return distance(begin, max_element(begin, end));
}
template <typename T>
size_t min_index(T begin, T end) {
  return distance(begin, min_element(begin, end));
}
using namespace std;
signed main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int num = 0;
  int n;
  string s;
  cin >> s;
  n = s.length();
  vector<bool> v(n, false);
  for (int i = 0; i < s.length() - 1; ++i) {
    if (v[i]) continue;
    if (!v[i + 1]) {
      if (s[i] != s[i + 1]) {
        v[i] = true;
        v[i + 1] = true;
        continue;
      }
    }
    for (int j = i + 1; j < s.length(); ++j) {
      if (!v[j]) {
        if (s[i] != s[j]) {
          v[i] = true;
          v[j] = true;
          break;
        }
      }
    }
  }
  for (auto it = v.begin(); it < v.end(); ++it)
    if (*it) num++;
  cout << num << endl;
  return 0;
}
