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