#include <bits/stdc++.h>
using namespace std;
struct Info {
  long long A, B;
};
bool operator<(const Info &left, const Info &right) { return left.A < right.A; }
unsigned long long XOR(unsigned long long A, unsigned long long B) {
  return A ^ B;
}
int main() {
  char S[100000];
  scanf("%s", S);
  int L = strlen(S);
  int count = 0;
  for (int i = 0; i < L - 1; i++) {
    if (S[i] == S[i + 1]) {
      count += 2;
      int l = i - 1;
      int u = i + 2;
      while (l >= 0 && u < L && S[l] == S[u]) {
        count += 2;
        l--;
        u++;
      }
      i = u - 1;
    }
  }
  cout << count << endl;
  return 0;
}
