#include <bits/stdc++.h>
#define ll long long
using namespace std;
void pVec(vector<int> f){
for(auto i : f) cout << f[i] << " ";
cout << endl;
}
int main() {
int t; cin >> t;
while(t--){
int n,k; cin >> n >> k;
string s; cin >> s;
char p = 'B';
vector<int> b(n+1,0);
for(int i=0;i<n;i++){
if(s[i] == 'B') b[i+1] = b[i] + 1;
else if(s[i] == '?' && k>0) b[i+1] = b[i] + 1,k--;
else b[i+1] = b[i];
}
int sub = 0, bs = b.size();
pVec(b);
// for(int i = 0;i<n;i++){
// sub += b[n-i] - b[i+1];
// }
cout << sub << endl;
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgbGwgbG9uZyBsb25nCnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgp2b2lkIHBWZWModmVjdG9yPGludD4gZil7Cglmb3IoYXV0byBpIDogZikJY291dCA8PCBmW2ldIDw8ICIgIjsKCWNvdXQgPDwgZW5kbDsKfQppbnQgbWFpbigpIHsKCWludCB0OwljaW4gPj4gdDsKCXdoaWxlKHQtLSl7CgkJaW50IG4sazsJY2luID4+IG4gPj4gazsKCQlzdHJpbmcgczsgY2luID4+IHM7CgkJY2hhciBwID0gJ0InOwoJCXZlY3RvcjxpbnQ+IGIobisxLDApOwoJCWZvcihpbnQgaT0wO2k8bjtpKyspewoJCQlpZihzW2ldID09ICdCJykJYltpKzFdID0gYltpXSArIDE7CgkJCWVsc2UgaWYoc1tpXSA9PSAnPycgJiYgaz4wKQliW2krMV0gPSBiW2ldICsgMSxrLS07CgkJCWVsc2UgYltpKzFdID0gYltpXTsKCQl9CgkJaW50IHN1YiA9IDAsIGJzID0gYi5zaXplKCk7CgkJcFZlYyhiKTsKCQkvLyBmb3IoaW50IGkgPSAwO2k8bjtpKyspewoJCS8vIAlzdWIgKz0gYltuLWldIC0gYltpKzFdOwoJCS8vIH0KCQljb3V0IDw8IHN1YiA8PCBlbmRsOwoJCQoJfQoJCglyZXR1cm4gMDsKfQ==