#include <bits/stdc++.h>
constexpr int N(1e5 + 5);
std::vector<int> a[N];
void ins(int x, int y) {
  a[x].insert(a[x].end(), a[y].begin(), a[y].end()), a[y].clear();
}
signed main(void) {
  static char S[N];
  scanf("%s", S + 1);
  int n(strlen(S + 1));
  std::vector<int> L[4];
  int cnt(0);
  for (int i(1), id; i <= n; ++i) {
    id = S[i] == 'L' ? 0 : 1;
    if (L[id ^ 1].size()) {
      a[L[id ^ 1].back()].push_back(i);
      L[id].push_back(L[id ^ 1].back()), L[id ^ 1].pop_back();
    } else if (L[id ^ 3].size()) {
      a[L[id ^ 3].back()].push_back(i);
      L[id ^ 2].push_back(L[id ^ 3].back()), L[id ^ 3].pop_back();
    } else {
      a[++cnt].push_back(i);
      L[id * 3].push_back(cnt);
    }
  }
  printf("%d\n", cnt - 1);
  int type(0);
  ++cnt;
  if (L[0].size() >= L[3].size()) {
    while (L[3].size()) {
      ins(cnt, L[0].back()), L[0].pop_back();
      ins(cnt, L[3].back()), L[3].pop_back();
    }
    type = L[0].size() ^ 1;
    if (L[0].size()) ins(cnt, L[0].back()), L[0].pop_back();
  } else {
    while (L[0].size()) {
      ins(cnt, L[3].back()), L[3].pop_back();
      ins(cnt, L[0].back()), L[0].pop_back();
    }
    type = 3;
    ins(cnt, L[3].back()), L[3].pop_back();
  }
  if (a[cnt].size()) L[type].push_back(cnt);
  assert(L[0].size() + L[3].size() <= 1);
  if (L[1].size()) {
    ++cnt;
    while (L[1].size()) ins(cnt, L[1].back()), L[1].pop_back();
    L[1].push_back(cnt);
  }
  if (L[2].size()) {
    ++cnt;
    while (L[2].size()) ins(cnt, L[2].back()), L[2].pop_back();
    L[2].push_back(cnt);
  }
  assert(L[1].size() <= 1 && L[2].size() <= 1);
  int ans;
  if (L[1].size() && L[2].size()) {
    int lr(L[1].back()), rl(L[2].back());
    if (a[lr].back() > a[rl].back())
      a[rl].push_back(a[lr].back()), a[lr].pop_back();
    else
      a[lr].push_back(a[rl].back()), a[rl].pop_back();
    ins(lr, rl), ans = 1;
  } else if (L[1].size())
    ans = 1;
  else if (L[2].size())
    ans = 2;
  else
    L[1].push_back(++cnt), ans = 1;
  if (L[0].size()) {
    if (ans == 1)
      ins(L[1].back(), L[0].back()), ans = L[1].back();
    else
      ins(L[0].back(), L[2].back()), ans = L[0].back();
  } else if (L[3].size()) {
    if (ans == 1)
      ins(L[3].back(), L[1].back()), ans = L[3].back();
    else
      ins(L[2].back(), L[3].back()), ans = L[2].back();
  } else
    ans = L[ans].back();
  for (auto i : a[ans]) printf("%d ", i);
  return 0;
}
