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