#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 7;
int n, t;
string s;
bool ans[N];
namespace fft {
using cx = complex<double>;
const double pi = acos(-1);
vector<int> rev;
int odwroc(int x) {
  for (int i = 0; i < 30 - i; ++i) {
    if (bool(x & (1 << i)) != bool(x & (1 << (30 - i)))) {
      x ^= 1 << i;
      x ^= 1 << (30 - i);
    }
  }
  return x;
}
void ensure(int n) {
  if (rev.size() < n) {
    rev.resize(n);
    for (int i = 0; i < n; ++i) {
      rev[i] = ((rev[i >> 1] >> 1) | (i & 1) << 30);
    }
  }
}
void dft(vector<cx> &a, bool inv) {
  int n = a.size();
  ensure(n);
  int l = 31 - __builtin_clz(n);
  int shift = 31 - l;
  for (int i = 0; i < n; ++i) {
    int r = rev[i] >> shift;
    if (i < r) swap(a[i], a[r]);
  }
  for (int s = 1; s < n; s <<= 1) {
    double ang = (inv ? -1 : 1) * pi / s;
    cx wn = cx(cos(ang), sin(ang));
    for (int j = 0; j < n; j += s + s) {
      cx w = 1;
      for (int k = j; k < j + s; ++k) {
        cx p = a[k] + w * a[k + s];
        cx q = a[k] - w * a[k + s];
        a[k] = p;
        a[k + s] = q;
        w *= wn;
      }
    }
  }
  if (inv) {
    for (int i = 0; i < n; ++i) {
      a[i] /= n;
    }
  }
}
vector<int> mult(vector<int> A, vector<int> B) {
  int b = 31 - __builtin_clz(A.size() + B.size() - 1);
  if ((1 << b) < A.size() + B.size() - 1) ++b;
  vector<cx> cA(1 << b), cB(1 << b);
  for (int i = 0; i < A.size(); ++i) {
    cA[i] = A[i];
  }
  for (int i = 0; i < B.size(); ++i) {
    cB[i] = B[i];
  }
  dft(cA, 0);
  dft(cB, 0);
  for (int i = 0; i < cA.size(); ++i) {
    cA[i] *= cB[i];
  }
  dft(cA, 1);
  vector<int> ans(A.size() + B.size() - 1);
  for (int i = 0; i < ans.size(); ++i) {
    ans[i] = int(cA[i].real() + 0.5);
  }
  return ans;
}
};  // namespace fft
void solve() {
  cin >> n >> s;
  vector<int> A(n), B(n);
  for (int i = 0; i < n; ++i) {
    if (s[i] == 'V')
      A[i] = 1;
    else if (s[i] == 'K')
      B[n - 1 - i] = 1;
  }
  vector<int> C = fft::mult(A, B);
  for (int i = 0; i < C.size(); ++i) {
    if (C[i]) ans[abs(n - 1 - i)] = 1;
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 2 * i; j <= n; j += i) {
      ans[i] |= ans[j];
    }
  }
  int res = 0;
  for (int i = 1; i <= n; ++i) {
    if (!ans[i]) ++res;
  }
  cout << res << '\n';
  for (int i = 1; i <= n; ++i) {
    if (!ans[i]) cout << i << " ";
    ans[i] = 0;
  }
  cout << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> t;
  while (t--) solve();
}
