#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  if (s.size() == 1) {
    cout << 0 << endl;
    return 0;
  }
  int i = 0;
  int ans = 0;
  while (true) {
    if (s[i] == s[i + 1]) {
      ans += 2;
      s.erase(i, 1);
      i = 0;
    } else {
      i++;
    }
    if (i == s.size() - 1) break;
  }
  cout << ans << endl;
  return 0;
}
