#include <bits/stdc++.h>
using namespace std;
const long long Mod = 1000000007;
struct P {
  long long pos, cost;
  bool operator<(const P &b) const { return cost < b.cost; }
  bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
  long long to, cost;
};
struct E {
  long long from, to, cost;
  bool operator<(const E &b) const { return cost < b.cost; }
  bool operator>(const E &b) const { return cost > b.cost; }
};
struct H {
  long long x, y;
  bool operator<(const H &b) const {
    if (x != b.x) return x < b.x;
    return y < b.y;
  }
  bool operator>(const H &b) const {
    if (x != b.x) return x > b.x;
    return y > b.y;
  }
  bool operator==(const H &b) const { return x == b.x && y == b.y; }
  bool operator!=(const H &b) const { return (*this) != b; }
};
long long gcd(long long i, long long j) {
  if (i > j) swap(i, j);
  if (i == 0) return j;
  return gcd(j % i, i);
}
long long mod_pow(long long x, long long n, long long p = Mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % p;
    x = x * x % p;
    n >>= 1;
  }
  return res;
}
const long long Inf = 3023372036854775807;
const int inf = 1500000000;
signed main() {
  string s;
  cin >> s;
  bool l = 1;
  long long ans = 0;
  while (l) {
    l = 0;
    for (long long i = 0; i < s.size(); i++) {
      while (i < s.size() && s[i] == '2') {
        i++;
      }
      if (i >= s.size() - 1) continue;
      long long j = i + 1;
      while (j < s.size() && s[j] == '2') {
        j++;
      }
      if (j == s.size()) continue;
      if (s[i] != s[j]) {
        s[i] = '2';
        s[j] = '2';
        ans += 2;
        l = 1;
      }
    }
  }
  cout << ans << endl;
}
