#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  string s;
  cin >> s;
  stack<char> st;
  int count = 0;
  for (int i = 0; i < s.length(); ++i) {
    if (!st.empty()) {
      if (st.top() != s[i]) {
        count += 2;
      } else {
        st.push(s[i]);
      }
    } else {
      st.push(s[i]);
    }
  }
  cout << count;
  return 0;
}
