#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int read() {
  int x = 0, f = 1;
  char ch;
  while (!isdigit(ch = getchar())) (ch == '-') && (f = -f);
  for (x = ch ^ 48; isdigit(ch = getchar());
       x = (x << 3) + (x << 1) + (ch ^ 48))
    ;
  return x * f;
}
template <class T>
T Max(T a, T b) {
  return a > b ? a : b;
}
template <class T>
T Min(T a, T b) {
  return a < b ? a : b;
}
char s[N];
int n, cnt, tpL, tpR, staL[N], staR[N];
vector<int> LL, LR, RL, RR, v[N];
void print(int x) {
  for (int i = 0; i < v[x].size(); ++i) printf("%d ", v[x][i]);
}
void printLRRL() {
  if (LR.empty()) {
    for (int i = 0; i < RL.size(); ++i) print(RL[i]);
    return;
  }
  if (RL.empty()) {
    for (int i = 0; i < LR.size(); ++i) print(LR[i]);
    return;
  }
  if (v[LR.back()].back() > v[RL.back()].back()) LR.swap(RL);
  v[LR.back()].push_back(v[RL.back()].back());
  v[RL.back()].pop_back();
  for (int i = 0; i < LR.size(); ++i) print(LR[i]);
  for (int i = 0; i < RL.size(); ++i) print(RL[i]);
}
void printLLRR(int t) {
  if (t) LL.swap(RR);
  for (int i = 0; i < LL.size(); ++i) {
    print(LL[i]);
    if (i < RR.size()) print(RR[i]);
  }
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 1, z; i <= n; ++i) {
    if (s[i] == 'L') {
      z = tpR ? staR[tpR--] : ++cnt;
      v[staL[++tpL] = z].push_back(i);
    } else {
      z = tpL ? staL[tpL--] : ++cnt;
      v[staR[++tpR] = z].push_back(i);
    }
  }
  printf("%d\n", cnt - 1);
  for (int i = 1; i <= cnt; ++i) {
    char x = s[v[i].front()], y = s[v[i].back()];
    if (x == 'L' && y == 'L') LL.push_back(i);
    if (x == 'L' && y == 'R') LR.push_back(i);
    if (x == 'R' && y == 'L') RL.push_back(i);
    if (x == 'R' && y == 'R') RR.push_back(i);
  }
  if (LR.empty() && RL.empty())
    printLLRR(RR.size() > LL.size());
  else {
    int o = LR.empty() ||
            (!RL.empty() && v[LR.back()].back() > v[RL.back()].back());
    if (LL.size() == RR.size())
      printLRRL(), printLLRR(o);
    else if (LL.size() > RR.size()) {
      if (!o) printLRRL();
      printLLRR(0);
      if (o) printLRRL();
    } else {
      if (o) printLRRL();
      printLLRR(1);
      if (!o) printLRRL();
    }
  }
  fclose(stdin);
  fclose(stdout);
  return 0;
}
