#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int dp[100010];
int main() {
  string s;
  cin >> s;
  int n = s.length();
  for (int i = 0, i_len = (n); i < i_len; i++) {
    if (i == 0)
      dp[0] == 0;
    else if (i == 1)
      dp[1] == (s[0] != s[1]) ? 2 : 0;
    else {
      if (s[i] != s[i - 1]) {
        dp[i] = max({dp[i - 1], dp[i - 2] + 2});
      } else {
        dp[i] = dp[i - 1];
      }
    }
  }
  cout << dp[n - 1];
  return 0;
}
