#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
using PII = pair<int, int>;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using V = vector<T>;
template <class T>
using V2 = vector<vector<T>>;
template <class T, int W = 255>
using A = array<T, W>;
template <class T, int W = 255, int H = 255>
using A2 = array<array<T, W>, W>;
V<LL> v;
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  std::string s;
  cin >> s;
  int l = s[0];
  for (int i = 0; i < static_cast<int>(s.size()); i++) {
    char x = (char)s[i];
    int ct = 1;
    while (i + 1 < s.size()) {
      if (x == s[i + 1]) {
        ct++;
        i++;
      } else
        break;
    }
    v.push_back((x == l) ? ct : -ct);
  }
  int n = 0;
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    n += v[i];
  }
  cout << s.size() - n << "\n";
}
