#include <bits/stdc++.h>
using namespace std;
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  stack<int> st;
  int n = s.size();
  cout << n << endl;
  for (int i = 0; i < n; i++) {
    if (st.empty()) {
      st.push(s[i] - '0');
      continue;
    }
    int tmp = st.top();
    if (tmp != (s[i] - '0')) {
      st.pop();
    } else
      st.push(s[i] - '0');
  }
  cout << n - st.size() << endl;
}
