#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
int main() {
  string s;
  cin >> s;
  int ans = 0, left = 0, right = 1;
  if (s.size() == 1) {
    cout << 0 << endl;
    return 0;
  }
  while (right < s.size()) {
    if (s[left] != s[right]) {
      right++;
      left = right - 1;
    } else {
      ans += 2;
      right++;
      left--;
      if (left < 0) {
        left = right - 1;
        continue;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
