#include <bits/stdc++.h>
using namespace std;
char s[100005];
int main(void) {
  scanf("%s", s);
  s[strlen(s)] = '2';
  int n = strlen(s) - 1;
  long long ans = 0;
  for (int i = (n - 1); i >= (0); i--) {
    if (s[i + 1] != '2' && s[i] != s[i + 1]) {
      ans += (long long)2;
      s[i] = s[i + 2];
    }
  }
  printf("%lld\n", ans);
  return 0;
}
