#include <bits/stdc++.h>
char s[100010];
char st[100010];
int tag[100010];
int t[100010];
int n;
int check(int x) {
  if (x < 2) {
    if (x == 0) {
      for (int i = 0; i < n; i++) {
        st[i] = s[i];
        if (st[i] == '?') st[i] = '0';
      }
      int s1 = 0, s2 = 0;
      for (int i = 0; i < n; i++)
        if (st[i] == '0')
          s1++;
        else
          s2++;
      return s1 >= s2 + 1;
    } else {
      int s1 = 0, s2 = 0;
      for (int i = 0; i < n; i++)
        if (s[i] == '0')
          s1++;
        else if (s[i] == '1')
          s2++;
      int tot = 0;
      for (int i = 0; i < n; i++)
        if (s[i] == '?') ++tot;
      if (s1 >= s2 + tot + 1) return 0;
      if (s2 >= s1 + tot + 2) return 0;
      int n1 = n / 2, n2 = n - n1;
      for (int i = 0; i < n; i++)
        if (s[i] != '?')
          st[i] = s[i];
        else if (s1 < n1) {
          s1++;
          st[i] = '0';
        } else {
          s2++;
          st[i] = '1';
        }
      memset(tag, 0, sizeof(tag));
      int i, p, q;
      for (i = 0, p = 0, q = 0; i < n - 2; i++) {
        if (i % 2 == 0) {
          while (p < n && st[p] == '0') p++;
          if (p == n) return 0;
          p++;
        } else {
          while (q < n && st[q] == '1') q++;
          if (q == n) return 0;
          q++;
        }
      }
      while (p < n && st[p] == '0') p++;
      if (p == n) return 0;
      while (q < n && st[q] == '1') q++;
      return q < p;
    }
  } else {
    if (x == 2) {
      int s1 = 0, s2 = 0;
      for (int i = 0; i < n; i++)
        if (s[i] == '0')
          s1++;
        else if (s[i] == '1')
          s2++;
      int tot = 0;
      for (int i = 0; i < n; i++)
        if (s[i] == '?') ++tot;
      if (s1 >= s2 + tot + 1) return 0;
      if (s2 >= s1 + tot + 2) return 0;
      int n1 = n / 2, n2 = n - n1;
      for (int i = 0; i < n; i++)
        if (s[i] != '?')
          st[i] = s[i];
        else if (s2 < n2) {
          s2++;
          st[i] = '1';
        } else {
          s1++;
          st[i] = '0';
        }
      memset(tag, 0, sizeof(tag));
      int i, p, q;
      for (i = 0, p = 0, q = 0; i < n - 2; i++) {
        if (i % 2 == 0) {
          while (p < n && st[p] == '0') p++;
          if (p == n) return 0;
          p++;
        } else {
          while (q < n && st[q] == '1') q++;
          if (q == n) return 0;
          q++;
        }
      }
      while (p < n && st[p] == '0') p++;
      if (p == n) return 0;
      while (q < n && st[q] == '1') q++;
      return q > p;
    } else {
      int s1 = 0, s2 = 0;
      for (int i = 0; i < n; i++)
        if (s[i] == '0')
          s1++;
        else
          s2++;
      return s2 >= s1 + 2;
    }
  }
}
int main() {
  scanf("%s", s);
  n = strlen(s);
  for (int i = 0; i < 4; i++)
    if (check(i)) {
      if ((i & 2) > 0)
        printf("1");
      else
        printf("0");
      if ((i & 1) > 0)
        printf("1");
      else
        printf("0");
      puts("");
    }
  return 0;
}
