#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const long long mod = 998244353;
int ans, vf = -1, l[100001];
string s;
int32_t main() {
  ios_base ::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (vf != -1 && s[l[vf]] == s[i]) {
      ans++;
      vf--;
    } else
      l[++vf] = i;
  }
  cout << ans * 2;
}
