#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int ans = 0, cnt = 0;
  for (int i = 1; i < s.size(); ++i) {
    if (s[i] == s[0])
      ++cnt;
    else
      --cnt, ans += 2;
  }
  cout << ans << endl;
  return 0;
}
