#include <bits/stdc++.h>
const int N = 200005;
char a[N], s[N];
int top = 0, ans;
int main() {
  scanf("%s", a + 1);
  int n = strlen(a + 1);
  for (int i = 1; i <= n; i++) {
    if (top == 0 || s[top] == a[i]) s[++top] = a[i];
    ans++, --top;
  }
  printf("%d", ans);
  return 0;
}
