#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
const double eps = 1e-12;
const int oo = 0x3f3f3f3f;
const int maxn = 200000;
int n;
char s[maxn + 5];
bool vis[maxn + 5];
vector<vector<int> > now;
set<int> a[2], b[2];
int main() {
  scanf("%s", s);
  int n = strlen(s);
  for (int i = 0; s[i]; ++i) {
    if (s[i] == 'L') {
      if (!(int((b[0]).size())) && !(int((b[1]).size()))) {
        b[0].insert((int((now).size())));
        now.push_back(vector<int>());
      }
      int t = b[0].empty() ? *b[1].begin() : *b[0].begin();
      b[(int((now[t]).size())) & 1].erase(t);
      now[t].push_back(i);
      a[(int((now[t]).size())) & 1].insert(t);
    } else {
      if (!(int((a[0]).size())) && !(int((a[1]).size()))) {
        a[0].insert((int((now).size())));
        now.push_back(vector<int>());
      }
      int t = a[0].empty() ? *a[1].begin() : *a[0].begin();
      a[(int((now[t]).size())) & 1].erase(t);
      now[t].push_back(i);
      b[(int((now[t]).size())) & 1].insert(t);
    }
  }
  for (int i = (0), _end_ = (2); i < _end_; ++i) a[i].clear(), b[i].clear();
  for (int i = (0), _end_ = ((int((now).size()))); i < _end_; ++i)
    if (s[now[i][0]] == 'L')
      a[(int((now[i]).size())) & 1].insert(i);
    else
      b[(int((now[i]).size())) & 1].insert(i);
  int cur = 0;
  if (make_pair((int((a[1]).size())), (int((a[0]).size()))) >
      make_pair((int((b[1]).size())), (int((b[0]).size()))))
    cur = a[0].empty() ? *a[1].begin() : *a[0].begin();
  else
    cur = b[0].empty() ? *b[1].begin() : *b[0].begin();
  int cnt = 0;
  int tmp = 0;
  int lst = -1;
  printf("%d\n", (int((now).size())) - 1);
  do {
    for (auto it : now[cur]) {
      if (lst != -1) tmp += it < lst;
      printf("%d ", it + 1);
      lst = it, ++cnt;
    }
    for (int i = (0), _end_ = (2); i < _end_; ++i) {
      if (a[i].count(cur)) a[i].erase(cur);
      if (b[i].count(cur)) b[i].erase(cur);
    }
    if (s[lst] == 'L') {
      if (!(int((b[0]).size())) && !(int((b[1]).size()))) break;
      cur = b[0].empty() ? *b[1].begin() : *b[0].begin();
    } else {
      if (!(int((a[0]).size())) && !(int((a[1]).size()))) break;
      cur = a[0].empty() ? *a[1].begin() : *a[0].begin();
    }
  } while (1);
  assert(cnt == n);
  assert(tmp == (int((now).size())) - 1);
  return 0;
}
