import java.util.Scanner;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] a = new int[n];
String s = sc.next();
int first = -1;
int last = 0;
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) == '0') a[i] = i + 1;
else {
// 首先第一次时先把first和last都更新到第一个不是0的位置
if (first == -1) {
first = i;
last = i;
} else {
// 先把上一次last所在位置(对于当前位置上的1来说的前一个1所在的位置)上的数进行更新
a[last] = i + 1;
last = i; // 然后再把last移动到当前的这个1所在的位置
}
}
}
// 因为最后一次循环后的操作是last = i; 并未更新a[last],循环到最后的1时需要和第一个1连接起来
// 想象为一个圈,前面已经更新的都是用自己后面的那个1所在的位置来更新自己
// 因此最后这个值应该用第一个1所在的位置来更新,即first处,因为first只有在第一次找到1时才进行了更新
a[last] = first + 1;
for (int num : a) {
System.out.print(num + " ");
}
sc.close();
}
}