#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int len = s.length();
  int ans = 0;
  for (int i = len - 1; i >= 1; i--) {
    if (i == len - 1) {
      if (s[i] != s[i - 1]) {
        ans += 2;
        i--;
      }
    } else {
      if (s[i] != s[i - 1]) {
        ans += 2;
        s[i - 1] = s[i + 1];
      }
    }
  }
  cout << ans << endl;
}
