#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main () {
int t;
cin >> t;
while (t --) {
int n;string s;
cin >> n >> s;
if (is_sorted(s.begin(), s.end())) {
puts("0");
}
else {
puts("1");
auto t =s;
sort(t.begin(), t.end());
vector<int> ans;

for (int i = 0; i < n; i ++) {
if (t[i] != s[i])
ans.push_back(i + 1);
}
cout << ans.size() << " ";
for (auto t : ans) cout << t << ' ';
puts("");
}
}
return 0;
}

容易知道我们能够在一次将数组排好 由于最终10交换,每个位置对答案都有贡献。所以如果不相等加入答案就行了