#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll>PII; const int N = 2e5 + 10; const int MOD = 998244353; const int INF = 0X3F3F3F3F; const int dx[] = {-1, 1, 0, 0, -1, -1, +1, +1}; const int dy[] = {0, 0, -1, 1, -1, +1, -1, +1}; const int M = 1e6 + 10; int a[N];//记录独特的 int fa[N];//记录自己的座位 int main() { int n; string s; cin >> n >> s; s = ' ' + s; int k = 0; for(int i = 1; i <= n; i ++) { if(s[i] == '1') a[++ k] = i;//找出来独特的 else{ fa[i] = i; } } if(k == 1) { for(int i = 1; i <= n; i ++) cout << i << " "; } else { if(k & 1)//是奇数取出前三个,后面的两两交换 { int o1 = a[1], o2 = a[2], o3 = a[3]; fa[o1] = o2, fa[o2] = o3, fa[o3] = o1; for(int i = 4; i <= k; i += 2) { int x = a[i], y = a[i + 1]; fa[x] = y; fa[y] = x; } } else {//偶数两两交换即可 for(int i = 1; i <= k; i += 2) { int x = a[i], y = a[i + 1]; fa[x] = y; fa[y] = x; } } for(int i = 1; i <= n; i ++) { cout << fa[i] << " ";//统一输出 } } }