#include <bits/stdc++.h>
using namespace std;
auto SOLUTION_FUNCTION(void) -> void {
  string s;
  cin >> s;
  stack<char> a, b;
  for (int i = 0; i < s.size(); ++i) a.push(s[i]);
  for (int i = s.size() - 1; i >= 0; --i) {
    b.push(s[i]);
  }
  int counter = 0;
  while ((!a.empty()) and (!b.empty())) {
    char x = a.top();
    char y = b.top();
    if (x == y) {
      a.pop();
      b.pop();
      counter += 2;
    } else {
      a.pop();
    }
  }
  cout << counter << '\n';
  return;
}
int main(void) {
  int testcase = 1;
  while (testcase--) {
    SOLUTION_FUNCTION();
  }
  return 0;
}
