#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string s;
  cin >> s;
  int n = s.size(), ans = 0;
  stack<int> ss;
  for (int i = 0; i < n; ++i) {
    int top;
    if (!ss.empty()) {
      top = ss.top();
      if (top != (int)s[i])
        ans += 2;
      else {
        ss.push(top);
        ss.push((int)s[i]);
      }
    } else {
      ss.push((int)s[i]);
    }
  }
  cout << ans << endl;
  return 0;
}
