#include <bits/stdc++.h>
using namespace std;
const int NR = 2e5 + 5;
int T,n,ans;
struct node{
int x,id;
bool operator < (const node & b){
return b.x > x;
}
}a[NR];
priority_queue<node>q;
string s;
int main (){
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin >> T;
while (T--){
cin >> n;
cin >> s;
if (n == 1){
cout << 0 << '\n';
continue;
}
ans = 0;
s = ' ' + s;
for (int i = 1; i <= n; ++i){
if (s[i] == 'L') {
ans += (i - 1);
a[i].x = n - 2 * i + 1;
a[i].id = 1;
q.push(node{n - 2 * i + 1,1});
}
else {
ans += (n - i);
a[i].x = 2 * i - n - 1;
a[i].id = 2;
q.push(node{2 * i - n - 1,2});
}
}
stack <node >st;
while (!q.empty()){
node tmp = q.top();
q.pop();
ans += tmp.x;
cout << ans << ' ';
}
cout << '\n';
}
return 0;
}