#include <bits/stdc++.h>
const int N = 100005;
int a[N], L[N], R[N], nxl[N], nxr[N], rec[N], cnt[2], n, ans = 0;
char ch[N];
bool vis[N];
int goL(int x) { return x == L[x] ? x : (L[x] = goL(L[x])); }
int goR(int x) { return x == R[x] ? x : (R[x] = goR(R[x])); }
int main() {
  int op, fi, x;
  scanf("%s", ch + 1);
  n = strlen(ch + 1);
  L[0] = R[0] = L[n + 1] = R[n + 1] = n + 1;
  for (int i = (n), e_ = (1); i >= e_; i--) {
    cnt[a[i] = (ch[i] == 'R')]++;
    L[i] = nxl[i] = L[0], R[i] = nxr[i] = R[0];
    a[i] ? R[i] = R[0] = i : L[i] = L[0] = i;
  }
  if (cnt[0] == cnt[1])
    op = a[1] ^ 1;
  else
    op = (cnt[0] > cnt[1] ? 1 : 0);
  while (rec[0] < n) {
    for (x = (op ? goL(0) : goR(0)); x <= n; x = (op ? goL(x) : goR(x))) {
      op = op ^ 1;
      assert(!vis[x]);
      rec[++rec[0]] = x, vis[x] = true;
      (!op) ? L[x] = goL(nxl[x]) : R[x] = goR(nxr[x]);
      if (!op && goL(goR(x)) > n && goL(0) > goR(0) ||
          op && goR(goL(x)) > n && goR(0) > goL(0))
        break;
    }
  }
  for (int i = (2), e_ = (rec[0]); i <= e_; i++)
    if (rec[i] < rec[i - 1]) ++ans;
  printf("%d\n", ans);
  for (int i = (1), e_ = (rec[0]); i <= e_; i++) printf("%d ", rec[i]);
  puts("");
  return 0;
}
