#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  string tmp_s;
  int out_cnt = 0;
  vector<string> s_v;
  for (int i = 0; i < s.length(); i++) {
    s_v.push_back(s.substr(i, 1));
  }
  vector<int> tmp_num_v;
  bool continue_flg = false;
  int i = 0;
  while (1) {
    if (s_v.empty() == true) {
      break;
    }
    if (i == s_v.size() - 1) {
      break;
    }
    if (s_v[i] == s_v[i + 1]) {
      out_cnt += 2;
      s_v.erase(s_v.begin() + i, s_v.begin() + i + 2);
      i = 0;
      continue;
    }
    i++;
  }
  cout << out_cnt << endl;
  return 0;
}
