题目
#include<bits/stdc++.h>
using namespace std;
const int maxn = 105;
string s;
void solve(){
int n;
//s = string(1000);
cin >> n >> s;
int l = 0, r = n - 1;
if(n % 2 == 1){
cout << "-1\n";
return;
}
int cnt = 0;
for(int i = 0; i < n; i++){
if(s[i] == '0') cnt++;
}
if(cnt * 2 != n){
cout << "-1\n";
return;
}
vector<int> ans;
cnt = 0;
while(l < r){
if(cnt > 300){
cout << "-1\n";
return;
}
if(s[l] != s[r]){
l++;
r--;
}
else if(s[l] == '0'){
ans.push_back(r + 1);
//s[r] = '0';
s.insert(r + 1, "01");//不能等效成插入0,因为会影响字符位置
l++;
r++;
}
else{
s.insert(l, "01");
ans.push_back(l);
l++;
r++;
}
cnt++;
}
cout << ans.size() << '\n';
for(auto x : ans){
cout << x << " \n"[x == ans.back()];
}
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int T;
cin >> T;
while(T--){
solve();
}
return 0;
}