#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int count = 0;
  bool kesita = false;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == s[i + 1]) {
      count += 2;
      kesita = true;
    }
    if (kesita == true) {
      if (s[i - 1] == s[i + 2]) {
        count += 2;
      }
      kesita = false;
    }
  }
  cout << count << endl;
}
