#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T &x) {
  int f = 0;
  x = 0;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar()) f |= (ch == '-');
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  if (f) x = -x;
}
const int N = (1 << 20) + 5, mod = 998244353;
int power(int x, int p) {
  int res = 1;
  for (; p; p >>= 1, x = (long long)x * x % mod)
    if (p & 1) res = (long long)res * x % mod;
  return res;
}
void add(int &x, int y) { x = (x + y >= mod ? x + y - mod : x + y); }
namespace Poly {
void dft(vector<int> &A, int n) {
  static unsigned long long w[N << 1], *W = w, *H[30], mx = 0;
  for (; mx < n; mx++) {
    H[mx] = W;
    unsigned long long w = 1, wn = power(3, (mod - 1) >> (mx + 1));
    for (int i = 0; i < (1 << mx); i++) *W++ = w, w = w * wn % mod;
  }
  static unsigned long long a[N];
  A.resize(1 << n);
  for (int i = 0, j = 0; i < (1 << n); i++) {
    a[i] = A[j];
    for (int k = 1 << (n - 1); (j ^= k) < k; k >>= 1)
      ;
  }
  for (int k = 0, d = 1; k < n; k++, d <<= 1)
    for (int i = 0; i < (1 << n); i += d << 1) {
      unsigned long long *l = a + i, *r = a + i + d, *w = H[k];
      for (int j = 0; j < d; j++, l++, r++) {
        unsigned long long t = *r * (*w++) % mod;
        *r = *l + mod - t, *l += t;
      }
    }
  for (int i = 0; i < (1 << n); i++) A[i] = a[i] % mod;
}
void idft(vector<int> &a, int n) {
  a.resize(1 << n);
  reverse(a.begin() + 1, a.end());
  dft(a, n);
  unsigned long long inv = power(1 << n, mod - 2);
  for (int i = 0; i < (1 << n); i++) a[i] = a[i] * inv % mod;
}
vector<int> mul(vector<int> a, vector<int> b) {
  int aim = a.size() + b.size();
  int n = 0;
  while ((1 << n) < aim) n++;
  dft(a, n), dft(b, n);
  for (int i = 0; i < (1 << n); i++) a[i] = (long long)a[i] * b[i] % mod;
  idft(a, n), a.resize(aim - 1);
  return a;
}
}  // namespace Poly
int x[N], y[N], ans[N], n;
vector<int> A, B, C;
char s[N];
void rmain() {
  read(n), scanf("%s", s + 1);
  for (int i = (0); i <= (n + 1); i++) x[i] = y[i] = ans[i] = 0;
  for (int i = (1); i <= (n); i++) {
    if (s[i] == 'V')
      x[i] = 1;
    else if (s[i] == 'K')
      x[i] = 2;
    y[n + 1 - i] = x[i];
  }
  A.resize(n + 1);
  B.resize(n + 1);
  for (int i = (1); i <= (n); i++) {
    A[i] = x[i] * x[i] * x[i];
    B[i] = y[i];
  }
  C = Poly::mul(A, B);
  for (int i = (1); i <= (n); i++) add(ans[i], C[n + i]);
  for (int i = (1); i <= (n); i++) {
    A[i] = mod - 2 * x[i] * x[i];
    B[i] = y[i] * y[i];
  }
  C = Poly::mul(A, B);
  for (int i = (1); i <= (n); i++) add(ans[i], C[n + i]);
  for (int i = (1); i <= (n); i++) {
    A[i] = x[i];
    B[i] = y[i] * y[i] * y[i];
  }
  C = Poly::mul(A, B);
  for (int i = (1); i <= (n); i++) add(ans[i], C[n + i]);
  for (int i = (1); i <= (n); i++) ans[i] = ans[i + 1];
  for (int i = (1); i <= (n); i++) {
    for (int j = i + i; j <= n; j += i) add(ans[i], ans[j]);
  }
  vector<int> res;
  for (int i = (1); i <= (n); i++)
    if (!ans[i]) res.push_back(i);
  printf("%d\n", (int)res.size());
  for (auto x : res) printf("%d ", x);
  puts("");
}
int main() {
  int T;
  read(T);
  while (T--) rmain();
  return 0;
}
