#include <bits/stdc++.h>
using namespace std;
char str[100010] = "\0";
int N = 0;
int Stack[100010] = {0};
int ST = 0, EN = 0;
int Next[100010] = {0};
int Pre[100010] = {0};
struct Line {
  int l, r;
  int St, En;
} line[100010] = {{0, 0, 0, 0}};
int lp = 0;
int type[2][2][100010] = {{{0}}};
int tp[2][2] = {{0}};
void prt(int x) {
  x = line[x].l;
  for (; Next[x] != 0; x = Next[x]) printf("%d ", x);
  printf("%d ", x);
  return;
}
int main() {
  scanf("%s", str + 1);
  N = strlen(str + 1);
  ST = 1, EN = 0;
  for (int i = 1; i <= N; i++) {
    if (str[i] == 'L')
      Stack[++EN] = i;
    else {
      if (ST <= EN) {
        Next[Stack[ST]] = i;
        Pre[i] = Stack[ST];
        Stack[ST++] = 0;
      }
    }
  }
  ST = 1, EN = 0;
  for (int i = 1; i <= N; i++) {
    if (str[i] == 'R')
      Stack[++EN] = i;
    else {
      if (ST <= EN) {
        Next[Stack[ST]] = i;
        Pre[i] = Stack[ST];
        Stack[ST++] = 0;
      }
    }
  }
  for (int i = 1; i <= N; i++) {
    if (Next[i] != 0 && str[i] == str[Next[i]]) fprintf(stderr, "fuck\n");
  }
  int Ans = 0;
  for (int i = 1; i <= N; i++)
    if (Next[i] == 0) Ans++;
  cout << Ans - 1 << endl;
  for (int i = 1; i <= N; i++) {
    if (Pre[i] == 0) {
      int cnt = i;
      lp++;
      line[lp].l = cnt;
      line[lp].St = (str[cnt] == 'R');
      for (;;) {
        if (Next[cnt] == 0) break;
        cnt = Next[cnt];
      }
      line[lp].r = cnt;
      line[lp].En = (str[cnt] == 'R');
      tp[line[lp].St][line[lp].En]++;
      type[line[lp].St][line[lp].En][tp[line[lp].St][line[lp].En]] = lp;
    }
  }
  if (tp[0][0] == tp[1][1]) {
    int x;
    for (x = 1; x < tp[0][0]; x++) {
      prt(type[0][0][x]);
      prt(type[1][1][x]);
    }
    for (int i = 1; i <= tp[0][1]; i++) prt(type[0][1][i]);
    for (int i = x; i <= tp[0][0]; i++) prt(type[0][0][i]);
    for (int i = 1; i <= tp[1][0]; i++) prt(type[1][0][i]);
    for (int i = x; i <= tp[1][1]; i++) prt(type[1][1][i]);
  } else if (tp[0][0] > tp[1][1]) {
    int x = tp[1][1];
    for (int i = 1; i <= x; i++) {
      prt(type[0][0][i]);
      prt(type[1][1][i]);
    }
    for (int i = 1; i <= tp[0][1]; i++) prt(type[0][1][i]);
    for (int i = x + 1; i <= tp[0][0]; i++) prt(type[0][0][i]);
    for (int i = 1; i <= tp[1][0]; i++) prt(type[1][0][i]);
  } else {
    int x = tp[0][0];
    for (int i = 1; i <= x; i++) {
      prt(type[1][1][i]);
      prt(type[0][0][i]);
    }
    for (int i = 1; i <= tp[1][0]; i++) prt(type[1][0][i]);
    for (int i = x + 1; i <= tp[1][1]; i++) prt(type[1][1][i]);
    for (int i = 1; i <= tp[0][1]; i++) prt(type[0][1][i]);
  }
  return 0;
}
