// Arup Guha
// 11/2/2013
// Solution to 2013 South East Regional Division 1,2 Problem C: Ping!

import java.util.*;

public class ping {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		String s = stdin.next();

		// Go through all of the cases.
		while (!s.equals("0")) {

			// Determines if total satellites are even or odd.
			ArrayList<Integer> list = new ArrayList<Integer>();

			// Just iterate through each element to see if we should print or not.
			for (int i=1; i<s.length(); i++) {

				// Figure out how many of the previous satellites divide into i.
				int item = s.charAt(i) - '0';
				int cnt = getCur(list, i);

				// Add this one in to match this bit.
				if (cnt%2 != item)
					list.add(i);
			}

			// Print out list.
			System.out.print(list.get(0));
			for (int i=1; i<list.size(); i++)
				System.out.print(" "+list.get(i));
			System.out.println();

			s = stdin.next();
		}
	}

	// Calculate the number of items in list that divide evenly into n.
	public static int getCur(ArrayList<Integer> list, int n) {
		int sum = 0;
		for (int i=0; i<list.size(); i++)
			if (n%list.get(i) == 0)
				sum++;
		return sum;
	}
}