#include <bits/stdc++.h>
using namespace std;
int read() {
  int s = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
  return f * s;
}
set<int> pos[2];
char ch[100010];
int n;
vector<int> fin, tmp, gg;
int s;
int solve(int bg) {
  tmp.clear();
  int ans = 0;
  pos[0].clear();
  pos[1].clear();
  for (int i = 1; i <= n; i++) pos[ch[i] == 'R'].insert(i);
  for (int i = 0, las = 0; i < n; i++, bg ^= 1) {
    if (*pos[bg].rbegin() < las) {
      tmp.push_back(*pos[bg].begin());
    } else {
      tmp.push_back(*pos[bg].upper_bound(las));
      if (pos[bg ^ 1].size() && *pos[bg].begin() < *pos[bg ^ 1].begin() &&
          tmp[i] > *pos[bg ^ 1].rbegin())
        tmp[i] = *pos[bg].begin();
    }
    ans += i == 0 ? 0 : tmp[i] < tmp[i - 1];
    pos[bg].erase(tmp[i]);
    las = tmp[i];
  }
  if (n >= 3 && tmp[n - 1] < tmp[n - 2] && tmp[n - 2] < tmp[n - 3])
    ans--, swap(tmp[n - 1], tmp[n - 3]);
  return ans;
}
int main() {
  scanf("%s", ch + 1);
  n = strlen(ch + 1);
  s = 0;
  int ans = 20021225;
  for (int i = 1; i <= n; i++) s += ch[i] == 'R';
  if (s == n - s) {
    int t = solve(0);
    if (t < ans) ans = t, fin = tmp;
    t = solve(1);
    if (t < ans) ans = t, fin = tmp;
  } else if (s < n - s)
    ans = solve(0), fin = tmp;
  else
    ans = solve(1), fin = tmp;
  printf("%d\n", ans);
  for (int i = 0; i < n; i++) printf("%d ", fin[i]);
  return 0;
}
