#include <bits/stdc++.h>
template <class T>
bool umax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
using namespace std;
int gcd(int a, int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int findGCD(int arr[], int n) {
  int result = arr[0];
  for (int i = 1; i < n; i++) result = gcd(arr[i], result);
  return result;
}
int main() {
  string S;
  int p1, p2;
  int wild;
  cin >> S;
  int point;
  int answer = 0;
  wild = S.find("22");
  for (int i = 0; i < S.length(); i++) {
    p1 = S.find("01", 0);
    p2 = S.find("10", 0);
    if (p1 != wild && p2 != wild) {
      point = min(p1, p2);
      S.erase(S.begin() + point, S.begin() + point + 1);
      answer = answer + 2;
    } else if (p1 != wild && p2 == wild) {
      S.erase(S.begin() + p1, S.begin() + p1 + 1);
      answer = answer + 2;
    } else if (p1 == wild && p2 != wild) {
      S.erase(S.begin() + p2, S.begin() + p2 + 1);
      answer = answer + 2;
    } else {
      break;
    }
  }
  cout << answer << endl;
  return 0;
}
