#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const int N = 2000100;
int v[N], ans[N], rev[N];
int L, n, len, cnt;
char s[N];
struct node {
  double x, y;
  node(double _x = 0.0, double _y = 0.0) : x(_x), y(_y) {}
  friend node operator+(node a, node b) { return node(a.x + b.x, a.y + b.y); }
  friend node operator-(node a, node b) { return node(a.x - b.x, a.y - b.y); }
  friend node operator*(node a, node b) {
    return node(a.x * b.x - a.y * b.y, a.x * b.y + a.y * b.x);
  }
} a[N], b[N];
void fft(node *a, int len, int k) {
  for (int i = 0; i < len; i++)
    if (rev[i] > i) swap(a[i], a[rev[i]]);
  for (int i = 2; i <= len; i *= 2) {
    node wn(cos(2 * pi / i), sin(2 * pi / i) * k);
    for (int j = 0; j < len; j += i) {
      node w(1, 0);
      for (int k = 0; k < i / 2; k++) {
        node x = a[j + k];
        node y = a[j + k + i / 2] * w;
        a[j + k] = x + y;
        a[j + k + i / 2] = x - y;
        w = w * wn;
      }
    }
  }
  if (k == -1) {
    for (int i = 0; i < len; i++) a[i].x = round(a[i].x / len);
  }
}
void Main() {
  scanf("%d", &n);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++) {
    a[i - 1] = node(s[i] == 'V', 0);
    b[n - i] = node(s[i] == 'K', 0);
  }
  for (len = 1, L = -1; len < 2 * n; len *= 2) L++;
  for (int i = 0; i < len; i++) rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << L);
  for (int i = n; i < len; i++) a[i] = b[i] = node(0, 0);
  fft(a, len, 1);
  fft(b, len, 1);
  for (int i = 0; i < len; i++) a[i] = a[i] * b[i];
  fft(a, len, -1);
  for (int i = 0; i <= n; i++) v[i] = 0;
  for (int i = 0; i < 2 * n; i++) v[abs(i - n + 1)] |= (a[i].x != 0);
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j += i) v[i] |= v[j];
  cnt = 0;
  for (int i = 1; i <= n; i++)
    if (!v[i]) cnt++;
  printf("%d\n", cnt);
  for (int i = 1; i <= n; i++)
    if (!v[i]) printf("%d ", i);
  printf("\n");
}
signed main() {
  int T;
  for (scanf("%d", &T); T; --T) Main();
}
