#include <bits/stdc++.h>
using namespace std;
char a[101000];
int main() {
  int cnt = 0;
  scanf("%s", a);
  for (int i = 0; a[i]; i += 2) {
    if ((a[i] == '0' && a[i + 1] == '1') || (a[i] == '1' && a[i + 1] == '0')) {
      cnt += 2;
      int j, k;
      for (j = i + 2, k = i - 1; a[j] && a[k]; j++, k--) {
        if ((a[j] == '0' && a[j] == '1') || (a[j] == '1' && a[k] == '0')) {
          cnt += 2;
        } else
          break;
      }
    }
  }
  cout << cnt;
  return 0;
}
