public void solve() {
    Scanner in = new Scanner(System.in);
    int n = in.nextInt();
    String s = in.next();
    int len = 1;
    while (true) {
      int cnt = (int) Math.pow(2, len);
//      System.out.println(cnt + "---" + len);
      Set<Integer> set = new TreeSet<Integer>();
      for (int i = 0; i + len <= s.length(); i++) {
        String sub = s.substring(i, i + len);
        int x = stringToInteger(sub);
        set.add(x);
        if (set.size() == cnt) {
          break;
        }
      }
//      System.out.println(set);
      if (set.size() < cnt) {
        int cur = 0;
        for (Integer integer : set) {
          if (integer != cur) {
            System.out.println(len);
            System.out.println(integerToString(cur, len));
            System.exit(0);
          }
          cur++;
        }
        System.out.println(len);
        System.out.println(integerToString(cur, len));
        System.exit(0);
      } else {
        len++;
      }
    }
  }