#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
set<int> st[2];
int n, cnt;
char s[N];
vector<int> res[N], id[4];
deque<int> L, R;
inline void out(vector<int>& v) {
  for (int i : v) printf("%d ", i);
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n; ++i)
    if (s[i] == 'L') {
      if (R.empty()) {
        res[++cnt].push_back(i);
        L.push_back(cnt);
      } else {
        int x = R.front();
        res[x].push_back(i);
        L.push_back(x);
        R.pop_front();
      }
    } else {
      if (L.empty()) {
        res[++cnt].push_back(i);
        R.push_back(cnt);
      } else {
        int x = L.front();
        res[x].push_back(i);
        R.push_back(x);
        L.pop_front();
      }
    }
  printf("%d\n", cnt - 1);
  for (int i = 1; i <= cnt; ++i) {
    const int zt = (s[res[i].front()] == 'R') << 1 | (s[res[i].back()] == 'R');
    id[zt].push_back(i);
  }
  if (id[3].size() > id[0].size()) {
    for (int i : id[2]) out(res[i]);
    while (id[3].size() && id[0].size()) {
      int x = id[3].back();
      id[3].pop_back();
      out(res[x]);
      x = id[0].back();
      id[0].pop_back();
      out(res[x]);
    }
    while (id[3].size()) {
      int x = id[3].back();
      id[3].pop_back();
      out(res[x]);
    }
    for (int i : id[1]) out(res[i]);
  } else if (id[3].size() < id[0].size()) {
    for (int i : id[1]) out(res[i]);
    while (id[3].size() && id[0].size()) {
      int x = id[0].back();
      id[0].pop_back();
      out(res[x]);
      x = id[3].back();
      id[3].pop_back();
      out(res[x]);
    }
    while (id[0].size()) {
      int x = id[0].back();
      id[0].pop_back();
      out(res[x]);
    }
    for (int i : id[2]) out(res[i]);
  } else {
    for (int i : id[2]) out(res[i]);
    while (id[3].size() > 1 && id[0].size() > 1) {
      int x = id[3].back();
      id[3].pop_back();
      out(res[x]);
      x = id[0].back();
      id[0].pop_back();
      out(res[x]);
    }
    while (id[3].size()) {
      int x = id[3].back();
      id[3].pop_back();
      out(res[x]);
    }
    for (int i : id[1]) out(res[i]);
    while (id[0].size()) {
      int x = id[0].back();
      id[0].pop_back();
      out(res[x]);
    }
  }
  return 0;
}
