import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Ping_artur {

  public static void main(String[] args) throws Exception {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    for (String s = in.readLine(); !"0".equals(s); s = in.readLine()) {
      char[] a = s.toCharArray();
      boolean first = true;
      for (int i = 1; i < a.length; i++)
        if (a[i] == '1') {
          System.out.print((first ? "" : " ") + i);
          first = false;
          for (int j = i; j < a.length; j += i)
            a[j] = (char) ('1' - a[j] + '0');
        }
      System.out.println();
    }
  }
}
