```go
package main
import (
"io"
"os"
)
func nextInt(data []byte, idx *int) int {
n := len(data)
for *idx < n && data[*idx] <= ' ' {
*idx++
}
val := 0
for *idx < n && data[*idx] > ' ' {
val = val*10 + int(data[*idx]-'0')
*idx++
}
return val
}
func nextBytes(data []byte, idx *int) []byte {
n := len(data)
for *idx < n && data[*idx] <= ' ' {
*idx++
}
start := *idx
for *idx < n && data[*idx] > ' ' {
*idx++
}
return data[start:*idx]
}
func appendInt(dst []byte, x int) []byte {
if x == 0 {
return append(dst, '0')
}
var buf [20]byte
i := len(buf)
for x > 0 {
i--
buf[i] = byte('0' + x%10)
x /= 10
}
return append(dst, buf[i:]...)
}
func main() {
data, _ := io.ReadAll(os.Stdin)
idx := 0
t := nextInt(data, &idx)
out := make([]byte, 0, len(data)*4)
for ; t > 0; t-- {
n := nextInt(data, &idx)
s := nextBytes(data, &idx)
runs := make([]int, 1, n+1)
cnt := 1
for i := 1; i < n; i++ {
if s[i] == s[i-1] {
cnt++
} else {
runs = append(runs, cnt)
cnt = 1
}
}
runs = append(runs, cnt)
R := len(runs) - 1
diff := make([]int, R+3)
for b := 1; b < R; b++ {
low := b + 1
diff[low]++
diff[low+1]--
L := 1
high := b + 1
for {
nxt := L + b
if nxt <= R && runs[nxt] >= 2 {
L = nxt
} else {
L = nxt + 1
}
low = L + b
if low > R {
break
}
high += b + 1
if high > R {
high = R
}
diff[low]++
diff[high+1]--
}
}
curPos := 0
pref := 0
first := true
for r := 1; r <= R; r++ {
curPos += diff[r]
base := pref - r + 1 + curPos
for j := 1; j <= runs[r]; j++ {
if !first {
out = append(out, ' ')
} else {
first = false
}
out = appendInt(out, base+j)
}
pref += runs[r]
}
out = append(out, '\n')
}
_, _ = os.Stdout.Write(out)
}
```