#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 6;
const int mod = 1e9 + 7;
char s[maxn];
int q[maxn];
int main() {
  scanf("%s", s);
  int l = strlen(s);
  int cnt = 0;
  int ans = 0;
  for (int i = 0; i < l; i++) {
    if (cnt == 0)
      q[cnt++] = s[i] - '0';
    else {
      if (q[cnt - 1] != s[i] - '0')
        ans += 2;
      else
        q[cnt++] = s[i] - '0';
    }
  }
  printf("%d\n", ans);
  return 0;
}
