#include <bits/stdc++.h>
using namespace std;
char s[100005];
int res[100005];
int main() {
  while (cin >> s) {
    set<int> s1, s2;
    int len = strlen(s);
    for (int i = 0; i < len; ++i)
      if (s[i] == 'L')
        s1.insert(i);
      else
        s2.insert(i);
    s1.insert(len);
    s2.insert(len);
    int cnt1 = 0, cnt2 = 0;
    bool flag = 0;
    if (len % 2) {
      for (int i = 0; i < len; ++i)
        if (s[i] == 'L')
          cnt1++;
        else
          cnt2++;
      if (cnt2 <= cnt1) flag = 1;
    } else {
      if (s[0] == 'L') flag = 1;
    }
    int now = -1;
    int temp;
    int ans = 0;
    bool flag2 = 0;
    for (int i = 0; i < len; ++i) {
      if (!flag)
        temp = *s2.upper_bound(now);
      else
        temp = *s1.upper_bound(now);
      if (temp == len) {
        ans++;
        flag2 = 1;
        if (!flag)
          temp = *s2.upper_bound(-1);
        else
          temp = *s1.upper_bound(-1);
      }
      if (!flag) {
        if (*s1.upper_bound(temp) == len) {
          int left = *s1.upper_bound(-1);
          int right = *s2.upper_bound(-1);
          if (left > right && temp != right) temp = right, ans++;
        }
      } else {
        if (*s2.upper_bound(temp) == len) {
          int left = *s1.upper_bound(-1);
          int right = *s2.upper_bound(-1);
          if (right > left && temp != left) temp = left, ans++;
        }
      }
      res[i] = temp + 1;
      if (!flag)
        s2.erase(s2.find(temp));
      else
        s1.erase(s1.find(temp));
      now = temp, flag = !flag;
    }
    printf("%d\n", ans);
    for (int i = 0; i < len; ++i) printf("%d%c", res[i], " \n"[i == len - 1]);
  }
}
