#include <bits/stdc++.h>
const int MAX_N = 100005;
char buffer[MAX_N];
int val[MAX_N];
int decided[MAX_N];
bool alive[MAX_N];
bool failed[2];
void read_vals(int &n) {
  scanf("%s", buffer);
  n = 0;
  for (int i = 0; buffer[i] != '\0'; i++) {
    if (buffer[i] == '0')
      val[i] = 0;
    else if (buffer[i] == '1')
      val[i] = 1;
    else
      val[i] = -1;
    n++;
  }
}
int num_undecided(int n) {
  int ans = 0;
  for (int i = 0; i < n; i++) ans += (val[i] == -1);
  return ans;
}
void forward(int n, int index[], int elim) {
  int cp = index[elim];
  if (!failed[elim]) {
    while (index[elim] < n &&
           !(decided[index[elim]] == elim && alive[index[elim]]))
      index[elim]++;
  } else
    index[elim] = n;
  if (index[elim] == n) {
    failed[elim] = true;
    index[elim] = cp;
    while (index[elim] < n && !alive[index[elim]]) index[elim]++;
    if (index[elim] == n) {
      index[elim] = 0;
      forward(n, index, elim);
    }
  }
}
int simulate(int n, int amount, int value) {
  for (int i = 0; i < n; i++) {
    if (val[i] == -1) {
      if (amount > 0)
        decided[i] = value;
      else
        decided[i] = 1 - value;
      amount--;
    } else
      decided[i] = val[i];
    alive[i] = true;
  }
  failed[0] = failed[1] = false;
  int index[2] = {0, 0};
  int eliminate = 1;
  for (int step = 0; step < n - 2; step++) {
    forward(n, index, eliminate);
    assert(alive[index[eliminate]]);
    alive[index[eliminate]] = false;
    eliminate = 1 - eliminate;
  }
  int ans = 0;
  int curr = 0;
  for (int i = 0; i < n; i++)
    if (alive[i]) {
      if (curr == 0)
        ans += 2 * decided[i];
      else
        ans += decided[i];
      curr++;
    }
  assert(curr == 2);
  return ans;
}
int first_number(int res) {
  if (res <= 1)
    return 0;
  else
    return 1;
}
bool possible(int n, int res) {
  int low = 0, high = num_undecided(n);
  while (low < high) {
    int mid = (low + high) / 2;
    int x = simulate(n, mid, first_number(res));
    if (res <= 1) {
      if (x <= res)
        high = mid;
      else
        low = mid + 1;
    } else {
      if (x < res)
        low = mid + 1;
      else
        high = mid;
    }
  }
  return (simulate(n, low, first_number(res)) == res);
}
int main() {
  int n;
  read_vals(n);
  for (int i = 0; i < 4; i++)
    if (possible(n, i)) printf("%d%d\n", (i >> 1) & 1, i & 1);
  return 0;
}
