#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1.01e9;
const double eps = 1e-9;
const int maxn = (int)1e5 + 10;
char s[maxn];
int n;
set<int> second[2];
pair<int, vector<int> > get(int x) {
  for (int i = 0; (i) < (2); ++i) second[i].clear();
  for (int i = 0; (i) < (n); ++i) {
    if (s[i] == 'L')
      second[0].insert(i);
    else
      second[1].insert(i);
  }
  vector<int> v;
  int pos = -1;
  int res = 0;
  for (int _ = 0; (_) < (n); ++_) {
    set<int>::iterator it = second[x].lower_bound(pos);
    if (it == second[x].end()) {
      pos = -1;
      it = second[x].lower_bound(pos);
      res += 1;
      if (it == second[x].end()) return make_pair(inf, vector<int>(n, -1));
      int last = v[_ - 1];
      if (((int)(second[x ^ 1]).size()) && *(second[x ^ 1].begin()) < *it) {
        int val = *second[x ^ 1].begin();
        second[x ^ 1].erase(val);
        second[x ^ 1].insert(last);
        v[_ - 1] = val;
        pos = val;
        it = second[x].lower_bound(pos);
      }
    }
    pos = *it;
    v.push_back(pos);
    second[x].erase(it);
    x ^= 1;
  }
  return make_pair(res, v);
}
int main() {
  scanf("%s", s);
  n = strlen(s);
  pair<int, vector<int> > r1 = get(0);
  pair<int, vector<int> > r2 = get(1);
  if (r1.first > r2.first) swap(r1, r2);
  printf("%d\n", r1.first);
  for (int i = 0; (i) < (n); ++i)
    printf("%d%c", r1.second[i] + 1, " \n"[i + 1 == n]);
  return 0;
}
