#include <bits/stdc++.h>
using namespace std;
template <class free>
struct Vector {
  free* a;
  int n, n1;
  inline Vector() { a = 0, n = n1 = 0; }
  inline void push_back(const free& x) {
    if (n < n1)
      a[n++] = x;
    else {
      free* a1(new free[n1 = n1 ? n1 << 1 : 1]);
      memcpy(a1, a, sizeof(free) * n);
      if (a) delete[] a;
      (a = a1)[n++] = x;
    }
  }
  inline free& operator[](const int x) { return a[x]; }
  inline free& back() { return a[n - 1]; }
};
char s[100050];
bool is[100050];
Vector<int> a[100050];
int sta[2][100050], top[2], at, a1[100050], a1t, a2[100050], a2t, ans[100050],
    anst;
int main() {
  scanf("%s", s + 1);
  int n(strlen(s + 1));
  for (int i(1); i <= n; ++i) is[i] = s[i] == 'R';
  for (int i(n), i1; i; --i) {
    if (top[is[i] ^ 1])
      a[sta[is[i]][++top[is[i]]] = sta[is[i] ^ 1][top[is[i] ^ 1]]].push_back(i),
          --top[is[i] ^ 1];
    else
      a[sta[is[i]][++top[is[i]]] = ++at].push_back(i);
  }
  for (int i(1); i <= at; ++i) reverse(a[i].a, a[i].a + a[i].n);
  memset(top, 0, sizeof(top));
  for (int i(1), j, i1; i <= at; ++i)
    if (is[*a[i].a] ^ is[a[i].back()]) {
      i1 = !is[a[i].back()];
      for (j = 0; j < a[i].n; ++j) sta[i1][++top[i1]] = a[i][j];
    } else if (is[a[i].back()])
      a2[++a2t] = i;
    else
      a1[++a1t] = i;
  for (int i(1), i1, j; i <= a1t && i <= a2t; ++i) {
    for (i1 = a1[i], j = 0; j < a[i1].n; ++j) sta[0][++top[0]] = a[i1][j];
    for (i1 = a2[i], j = 0; j < a[i1].n; ++j) sta[0][++top[0]] = a[i1][j];
  }
  bool pd(false);
  if (top[0] && top[1]) {
    bool i1(sta[0][top[0]] < sta[1][top[1]]);
    pd = !i1;
    anst = top[!i1], memcpy(ans, sta[!i1], anst + 1 << 2);
    ans[++anst] = sta[i1][top[i1]];
    for (int i(1); i < top[i1]; ++i) ans[++anst] = sta[i1][i];
  } else if (top[0])
    anst = top[0], memcpy(ans, sta[0], anst + 1 << 2);
  else if (top[1])
    anst = top[1], memcpy(ans, sta[1], anst + 1 << 2), pd = true;
  if (a1t ^ a2t) {
    int i1;
    i1 = a1t > a2t ? a1[a1t] : a2[a2t];
    if ((!pd && a1t > a2t) || (pd && a2t > a1t)) {
      for (int i(0); i < a[i1].n; ++i) ans[++anst] = a[i1][i];
    } else {
      for (int i(anst); i; --i) ans[i + a[i1].n] = ans[i];
      memcpy(ans + 1, a[i1].a, a[i1].n << 2);
      anst += a[i1].n;
    }
  }
  printf("%d\n", at - 1);
  for (int i(1); i <= anst; ++i) printf("%d ", ans[i]);
  return 0;
}
