#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
char a[maxn];
char b[maxn];
int main() {
  scanf("%s", a);
  int n = strlen(a);
  int sum = 0;
  if (n == 1) {
    printf("0\n");
  } else {
    int w = 0;
    for (int i = 0; i < n;) {
      if (a[i] != a[i + 1]) {
        i = i + 2;
        sum += 2;
      } else {
        i++;
      }
    }
    printf("%d\n", sum);
  }
}
