#include <bits/stdc++.h>
const int MAXN = 100000;
std::set<int> pos[2];
int n;
int a[MAXN + 10];
int ans[MAXN + 10], anst;
int sta[MAXN + 10], top;
void work(int now) {
  for (int i = 1; i <= n; i++) pos[a[i]].insert(i);
  now = (*pos[now].begin());
  top = 0;
  int cnt = 0;
  while (true) {
    std::set<int>::iterator it = pos[a[now] ^ 1].lower_bound(now);
    sta[++top] = now;
    pos[a[now]].erase(now);
    if (pos[1].empty() && pos[0].empty()) break;
    int nxt = 0;
    if (it != pos[a[now] ^ 1].end()) {
      nxt = (*it);
      std::set<int>::iterator that = pos[a[now]].lower_bound(nxt);
      if (that == pos[a[now]].end() &&
          (*pos[a[now] ^ 1].begin()) < (*pos[a[now]].begin())) {
        nxt = (*pos[a[now] ^ 1].begin());
        cnt++;
      }
    } else {
      nxt = (*pos[a[now] ^ 1].begin());
      cnt++;
    }
    now = nxt;
  }
  if (cnt < anst) {
    anst = cnt;
    for (int i = 1; i <= n; i++) ans[i] = sta[i];
  }
  return;
}
void init() {
  anst = MAXN + 10;
  char c = getchar();
  int f = 0;
  while (c == 'L' || c == 'R') {
    a[++n] = (c == 'L');
    if (c == 'L')
      f++;
    else
      f--;
    c = getchar();
  }
  if (f == -1)
    work(0);
  else if (f == 0) {
    work(0);
    work(1);
  } else
    work(1);
  printf("%d\n", anst);
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  return;
}
int main() {
  init();
  return 0;
}
