#include <bits/stdc++.h>
using namespace std;
template <typename T>
void _R(T &x) {
  cin >> x;
}
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%" PRId64, &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template <typename T, typename... U>
void R(T &head, U &...tail) {
  _R(head);
  R(tail...);
}
template <typename T>
void _W(const T &x) {
  cout << x;
}
void _W(const int &x) { printf("%d", x); }
void _W(const long long &x) { printf("%" PRId64, x); }
template <typename T>
void _W(const vector<T> &x) {
  for (auto i = x.cbegin(); i != x.cend(); i++) {
    if (i != x.cbegin()) putchar(' ');
    _W(*i);
  }
}
void W() {}
template <typename T, typename... U>
void W(const T &head, const U &...tail) {
  _W(head);
  putchar(sizeof...(tail) ? ' ' : '\n');
  W(tail...);
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return b > a ? a = b, true : false;
}
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return b < a ? a = b, true : false;
}
template <typename T, typename F>
inline void sort_uniq(vector<T> &v, F f) {
  sort(begin(v), end(v), f);
  v.resize(unqiue(begin(v), end(v)) - v.begin());
}
template <typename T>
using MaxHeap = priority_queue<T>;
template <typename T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
namespace Mul {
const double pi = acos(-1.0);
struct Complex {
  double re, im;
  Complex(double _re = 0, double _im = 0) : re(_re), im(_im) {}
  Complex operator+(const Complex &x) const { return {re + x.re, im + x.im}; }
  Complex operator-(const Complex &x) const { return {re - x.re, im - x.im}; }
  Complex operator*(const Complex &x) const {
    return {re * x.re - im * x.im, re * x.im + im * x.re};
  }
};
void fft(vector<Complex> &a, int dir) {
  int n = a.size();
  for (int i = 0, j = 1; j < n - 1; j++) {
    for (int k = n >> 1; k > (i ^= k); k >>= 1)
      ;
    if (i < j) swap(a[i], a[j]);
  }
  for (int m = 1; m + m <= n; m <<= 1) {
    Complex wm(cos(dir * pi / m), sin(dir * pi / m));
    for (int k = 0; k < n; k += m + m) {
      Complex w = 1;
      for (int j = k; j < k + m; j++) {
        Complex u = a[j], v = a[j + m] * w;
        a[j] = u + v;
        a[j + m] = u - v;
        w = w * wm;
      }
    }
  }
}
void mul(int na, const int *a, int nb, const int *b, int *c) {
  static vector<Complex> x, y;
  assert(na > 0 && nb > 0);
  int n = 1;
  while (n < 2 * max(na, nb)) n *= 2;
  x.resize(n);
  y.resize(n);
  for (int i = 0; i < n; i++) x[i] = y[i] = 0;
  for (int i = 0; i < na; i++) x[i] = a[i];
  for (int i = 0; i < nb; i++) y[i] = b[i];
  fft(x, +1);
  fft(y, +1);
  for (int i = 0; i < n; i++) x[i] = x[i] * y[i];
  fft(x, -1);
  for (int i = 0; i < n; i++) x[i].re /= n;
  for (int i = 0; i < na + nb - 1; i++) c[i] = x[i].re + 0.5;
}
vector<int> mul(const vector<int> &a, const vector<int> &b) {
  int na = a.size(), nb = b.size();
  assert(na > 0 && nb > 0);
  vector<int> c(na + nb - 1);
  mul(na, a.data(), nb, b.data(), c.data());
  return c;
}
};  // namespace Mul
using Mul::mul;
const int N = 1e6 + 10;
int n, a[N], b[N], c[N];
char s[N];
bool z[N];
void go(char c1, char c2) {
  for (int i = 0; i < int(n); i++) a[i] = (s[i] == c1);
  for (int i = 0; i < int(n); i++) b[i] = (s[n - i - 1] == c2);
  mul(n, a, n, b, c);
  for (int i = 0; i < int(2 * n - 1); i++)
    if (c[i]) z[abs(i - n + 1)] |= 1;
}
int main() {
  int t;
  R(t);
  while (t--) {
    R(n, s);
    for (int i = (1); i <= int(n); i++) z[i] = 0;
    go('V', 'K');
    vector<int> sol;
    for (int i = (1); i <= int(n); i++) {
      bool zz = 0;
      for (int j = i; j < n && !zz; j += i) zz |= z[j];
      if (!zz) sol.push_back(i);
    }
    W(((int)(sol).size()));
    W(sol);
  }
  return 0;
}
