#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int n = S.length(), count = 0;
  bool flag = 1;
  if (n - 1) {
    if (S[0] != S[1]) {
      count++;
      if (n - 2) {
        S[0] = S[2];
        S[1] = S[2];
      }
    }
    while (flag) {
      flag = 0;
      for (int i = 1; i < n - 1; i++) {
        if (S[i] != S[i + 1]) {
          S[i] = S[i - 1];
          S[i + 1] = S[i - 1];
          count++;
          flag++;
        }
      }
    }
  }
  cout << 2 * count << endl;
}
