#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  string tmp_s;
  int out_cnt = 0;
  vector<bool> check_flg(s.length());
  for (int i = 0; i < s.length(); i++) {
    check_flg[i] = false;
  }
  for (int i = 0; i < s.length() - 1; i++) {
    int cnt = 0;
    if (s.substr(i, 1) == s.substr(i + 1, 1) & check_flg[i] == false &
        check_flg[i + 1] == false) {
      out_cnt += 2;
      check_flg[i] = true;
      check_flg[i + 1] = true;
      int tmp_num = i;
      cnt = 1;
      while (1) {
        if (tmp_num - cnt < 0 | tmp_num + 1 + cnt >= s.length()) {
          break;
        } else if (check_flg[tmp_num - cnt] == true |
                   check_flg[tmp_num + 1 + cnt] == true) {
          break;
        }
        if (s.substr(tmp_num - cnt, 1) == s.substr(tmp_num + 1 + cnt), 1) {
          out_cnt += 2;
          check_flg[tmp_num - cnt] = true;
          check_flg[tmp_num + 1 + cnt] = true;
        }
        cnt++;
      }
    }
  }
  cout << out_cnt << endl;
  return 0;
}
