#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int main(int argc, char const* argv[]) {
  string s;
  cin >> s;
  int n = ((int)(s).size());
  int ans = 0;
  for (int i = 1; i <= n - 2; i++) {
    if (s[i] != s[i - 1] && s[i] != s[i + 1])
      ans += 3;
    else
      ans += 2;
    i += 2;
  }
  cout << ans << endl;
  return 0;
}
