#include <bits/stdc++.h>
using namespace std;
stack<int> oo;
string u;
int ans = 0, j = 0;
int b[100010];
int main() {
  cin >> u;
  for (int i = 0; i < u.size(); i++) {
    b[i] = u[i] - '0';
  }
  while (j < u.size()) {
    oo.push(b[j]);
    if (b[j + 1] != oo.top()) {
      ans += 2;
      oo.pop();
      j += 2;
    } else if (b[j + 1] == oo.top()) {
      j++;
    }
  }
  cout << ans;
  return 0;
}
