#include <bits/stdc++.h>
using namespace std;
string s;
int ans = 0;
string new_s, s_left, s_right;
void solve(string s) {
  if (s == "") return;
  size_t length = s.length();
  for (int i = 0; i < (int)(length); i++) {
    if (i + 1 >= length) return;
    if (s[i] != s[i + 1]) {
      if (i > 0) {
        ans += 2;
        s_left = s.substr(0, i);
        s_right = s.substr(i + 2, length);
        new_s = s_left + s_right;
        if (new_s == "") return;
        return solve(new_s);
      } else {
        ans += 2;
        new_s = s.substr(i + 2, length);
        if (new_s == "") return;
        return solve(new_s);
      }
    }
  }
  return;
}
int main() {
  cin >> s;
  solve(s);
  cout << ans << endl;
  return 0;
}
