#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;
const long long LINF = 1001001001001001001;
const int MOD = 1e9 + 7;
long long N = 0;
long long ret = 0;
string str;
stack<char> s;
char c;
char ne;
void input() { cin >> str; }
void solve() {
  c = str[0];
  s.push(c);
  for (int i = (1); i < (str.size()); i++) {
    c = s.top();
    ne = str[i];
    if (c != ne) {
      ret += 2;
    } else {
      s.push(ne);
    }
  }
}
int main(void) {
  input();
  solve();
  cout << (ret) << endl;
}
