#include <bits/stdc++.h>
using namespace std;
set<int> L, R;
int ending[100050];
int typ[100050];
int sc;
char str[100050];
int main() {
  scanf("%s", str + 1);
  int len = strlen(str + 1);
  for (int i = 1; i <= len; ++i) {
    if (str[i] == 'L')
      L.insert(i);
    else
      R.insert(i);
  }
  bool begin = 1;
  int cnt = -1;
  while (L.size() || R.size()) {
    if (begin) {
      cnt++;
      if (!sc) {
        if (R.size() > L.size()) {
          int ps = *(R.begin());
          R.erase(ps);
          ending[++sc] = ps;
          typ[sc] = 1;
        } else if (R.size() < L.size()) {
          int ps = *(L.begin());
          L.erase(ps);
          ending[++sc] = ps;
          typ[sc] = 0;
        } else {
          int psL = *(L.begin()), psR = *(R.begin());
          if (psL < psR) {
            int ps = *(L.begin());
            L.erase(ps);
            ending[++sc] = ps;
            typ[sc] = 0;
          } else {
            int ps = *(R.begin());
            R.erase(ps);
            ending[++sc] = ps;
            typ[sc] = 1;
          }
        }
      } else {
        int psL = L.size() ? *(L.begin()) : 0x3f3f3f3f,
            psR = R.size() ? *(R.begin()) : 0x3f3f3f3f;
        if (psL < psR) {
          if (typ[sc] == 0) {
            L.insert(ending[sc]);
            sc--;
          }
          ending[++sc] = psL;
          typ[sc] = 0;
          L.erase(psL);
        } else {
          if (typ[sc] == 1) {
            R.insert(ending[sc]);
            sc--;
          }
          ending[++sc] = psR;
          typ[sc] = 1;
          R.erase(psR);
        }
      }
      begin = 0;
    } else {
      if (typ[sc] == 1) {
        if (L.lower_bound(ending[sc]) == L.end()) {
          begin = 1;
          continue;
        }
        int ps = *L.lower_bound(ending[sc]);
        L.erase(ps);
        ending[++sc] = ps;
        typ[sc] = 0;
      } else {
        if (R.lower_bound(ending[sc]) == R.end()) {
          begin = 1;
          continue;
        }
        int ps = *R.lower_bound(ending[sc]);
        R.erase(ps);
        ending[++sc] = ps;
        typ[sc] = 1;
      }
    }
  }
  printf("%d\n", cnt);
  for (int i = 1; i <= len; ++i) printf("%d ", ending[i]);
}
