#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  queue<char> q;
  int count = 0;
  for (int i = 0; i < s.size();) {
    if (i != s.size() - 1) {
      if ((s[i] - '0') + (s[i + 1] - '0') == 1) {
        count += 2;
        if (i + 2 >= s.size()) {
          i++;
        } else {
          i += 2;
        }
      } else {
        if (q.size() == 0) {
          q.push(s[i]);
        } else {
          if ((q.front() - '0') + (s[i] - '0') == 1) {
            count += 2;
            q.pop();
          } else {
            q.push(s[i]);
          }
        }
        i++;
      }
    } else {
      if (q.size() == 0) {
        q.push(s[i]);
      } else {
        if ((q.front() - '0') + (s[i] - '0')) {
          count += 2;
          q.pop();
        }
      }
      i++;
    }
  }
  cout << count << endl;
}
