#include <bits/stdc++.h>
using namespace std;
const long long int L = 1e5 + 5;
vector<long long int> flag(L);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin >> s;
  long long int j = 1;
  long long int cnt = 0;
  for (long long int i = 0;
       i < (long long int)s.size() && j < (long long int)s.size(); i++, j++) {
    while (flag[i] == 1) {
      i++;
    }
    if (i == j) {
      j++;
    }
    if (i > j) {
      break;
    }
    if (s[i] != s[j]) {
      flag[i] = 1;
      flag[j] = 1;
      if (i) {
        i -= 2;
      } else {
        i = 1;
        j = 2;
      }
      cnt++;
    }
  }
  cout << cnt * 2 << "\n";
  return 0;
}
