#include <bits/stdc++.h>
using namespace std;
int n, v[100000 + 5];
char s[100000 + 5];
set<int> S[2];
inline int Solve(register int x) {
  register int i, t = 0;
  for (i = 1; i <= n; ++i) S[s[i] == 'R'].insert(i);
  register int p = 0;
  for (i = 1; i <= n; S[x].erase(v[i] = p), ++i, x ^= 1)
    p = S[x].lower_bound(p) == S[x].end() ? (++t, *S[x].begin())
                                          : *S[x].lower_bound(p),
    S[x ^ 1].lower_bound(p) == S[x ^ 1].end() && p ^ *S[x].begin() &&
        *S[x].begin() < *S[x ^ 1].begin() && (p = *S[x].begin(), ++t);
  return t;
}
int main() {
  register int i, t = 0;
  for (scanf("%s", s + 1), n = strlen(s + 1), i = 1; i <= n; ++i)
    s[i] == 'L' ? ++t : --t;
  for (printf("%d\n", t ? Solve(t == -1) : Solve(s[1] == 'R')), i = 1; i <= n;
       ++i)
    printf("%d ", v[i]);
  return 0;
}
