#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:66777216")
using namespace std;
int RAND() { return (rand() << 16) + rand(); }
const int N = 100000 + 5;
char s[N];
int a[N];
int e[N];
int n;
int res;
int b[N];
int top;
int C = 0;
int r[N];
int mi[2][4 * N];
int ma[2][4 * N];
int su[2][4 * N];
int mv[2][4 * N];
void fix(int v) {
  for (int u = 0; u < (int)(2); ++u) {
    su[u][v] = su[u][v + v] + su[u][v + v + 1];
    mi[u][v] = min(mi[u][v + v], su[u][v + v] + mi[u][v + v + 1]);
    ma[u][v] = max(ma[u][v + v], su[u][v + v] + ma[u][v + v + 1]);
    mv[u][v] = min(mv[u][v + v], mv[u][v + v + 1]);
  }
}
void build(int v, int tl, int tr) {
  if (tl == tr) {
    su[0][v] = e[tl];
    su[1][v] = -su[0][v];
    for (int u = 0; u < (int)(2); ++u) {
      mi[u][v] = min(0, su[u][v]);
      ma[u][v] = max(0, su[u][v]);
    }
    mv[0][v] = mv[1][v] = N;
    if (e[tl] == -1)
      mv[0][v] = tl;
    else
      mv[1][v] = tl;
    return;
  }
  int tm = (tl + tr) / 2;
  build(v + v, tl, tm);
  build(v + v + 1, tm + 1, tr);
  fix(v);
}
void update(int v, int tl, int tr, int pos, int val) {
  if (tl == tr) {
    su[0][v] = val;
    su[1][v] = -val;
    mv[0][v] = mv[1][v] = N;
    for (int u = 0; u < (int)(2); ++u) {
      mi[u][v] = min(0, su[u][v]);
      ma[u][v] = max(0, su[u][v]);
      if (val == 2 * u - 1) mv[u][v] = tl;
    }
    return;
  }
  int tm = (tl + tr) / 2;
  if (pos <= tm)
    update(v + v, tl, tm, pos, val);
  else
    update(v + v + 1, tm + 1, tr, pos, val);
  fix(v);
}
int getpos(int v, int tl, int tr, int l, int r, int u) {
  if (l <= tl && tr <= r) return mv[u][v];
  int tm = (tl + tr) / 2;
  int res = N;
  if (l <= tm) res = min(res, getpos(v + v, tl, tm, l, r, u));
  if (r > tm) res = min(res, getpos(v + v + 1, tm + 1, tr, l, r, u));
  return res;
}
void init() {
  top = 0;
  C = 0;
  build(1, 0, n - 1);
}
void checkback(int cr) {
  int ne = getpos(1, 0, n - 1, cr + 1, n - 1, a[cr] ^ 1);
  if (ne == N) return;
  int be = getpos(1, 0, n - 1, ne + 1, n - 1, a[cr]);
  if (be != N) return;
  be = getpos(1, 0, n - 1, ne + 1, n - 1, a[cr] ^ 1);
  if (be != N) return;
  int u = a[cr];
  update(1, 0, n - 1, ne, 0);
  update(1, 0, n - 1, cr, 0);
  if (su[u][1] == 0 && mi[u][1] == 0) {
    if (C + ma[u][1] < res) {
      int val2 = C + ma[u][1];
      int C2 = C;
      int top2 = top;
      update(1, 0, n - 1, cr, a[cr]);
      while (1) {
        b[top++] = cr;
        int ne = getpos(1, 0, n - 1, cr + 1, n - 1, a[cr] ^ 1);
        if (ne == N) ne = getpos(1, 0, n - 1, 0, n - 1, a[cr] ^ 1);
        if (ne == N) break;
        if (ne < cr) ++C;
        update(1, 0, n - 1, cr, 0);
        cr = ne;
      }
      assert(val2 == C);
      b[top++] = ne;
      res = C;
      for (int i = 0; i < (int)(n); ++i) r[i] = b[i];
      for (int i = top2; i < top; ++i) update(1, 0, n - 1, b[i], e[b[i]]);
      top = top2;
      C = C2;
    }
  }
  update(1, 0, n - 1, ne, e[ne]);
  update(1, 0, n - 1, cr, e[cr]);
}
void solvefor(bool ty) {
  init();
  int cr = getpos(1, 0, n - 1, 0, n - 1, ty);
  while (1) {
    checkback(cr);
    b[top++] = cr;
    int ne = getpos(1, 0, n - 1, cr + 1, n - 1, a[cr] ^ 1);
    if (ne == N) ne = getpos(1, 0, n - 1, 0, n - 1, a[cr] ^ 1);
    if (ne == N) break;
    if (ne < cr) ++C;
    update(1, 0, n - 1, cr, 0);
    cr = ne;
  }
  if (C < res) {
    res = C;
    for (int i = 0; i < (int)(n); ++i) r[i] = b[i];
  }
}
void solve() {
  scanf("%s", s);
  n = strlen(s);
  int q[2] = {0, 0};
  for (int i = 0; i < (int)(n); ++i) {
    if (s[i] == 'R') a[i] = 1;
    e[i] = a[i] * 2 - 1;
    ++q[a[i]];
  }
  res = N;
  if (q[1] >= q[0]) solvefor(1);
  if (q[0] >= q[1]) solvefor(0);
  printf("%d\n", res);
  for (int i = 0; i < (int)(n); ++i) printf("%d ", r[i] + 1);
  puts("");
}
void testgen() {
  FILE* f = fopen("input.txt", "w");
  fclose(f);
}
int main() {
  cout << fixed;
  cout.precision(16);
  cerr << fixed;
  cerr.precision(3);
  solve();
  return 0;
}
