#include <bits/stdc++.h>
using namespace std;
const int inf = 987654321;
const long long int INF = 123456789987654321;
string S;
vector<int> nxt, chk, tmp, ans;
vector<vector<int> > arr;
set<int> l, rl, rr;
vector<vector<int> > arr1;
vector<vector<int> > lltmp, rrtmp;
void mrg1() {
  lltmp.clear();
  rrtmp.clear();
  arr1.clear();
  for (int i = 0; i < arr.size(); i++) {
    if (S[arr[i][0]] == 'L' && S[arr[i].back()] == 'L') {
      lltmp.push_back(arr[i]);
    } else if (S[arr[i][0]] == 'R' && S[arr[i].back()] == 'R') {
      rrtmp.push_back(arr[i]);
    } else
      arr1.push_back(arr[i]);
  }
  tmp.clear();
  int isl = lltmp.size() > rrtmp.size() ? 1 : 0;
  int pos1 = 0, pos2 = 0;
  while (1) {
    if (isl) {
      if (pos1 == lltmp.size()) break;
      for (int i = 0; i < lltmp[pos1].size(); i++) {
        tmp.push_back(lltmp[pos1][i]);
      }
      isl = 0;
      pos1++;
    } else {
      if (pos2 == rrtmp.size()) break;
      for (int i = 0; i < rrtmp[pos2].size(); i++) {
        tmp.push_back(rrtmp[pos2][i]);
      }
      isl = 1;
      pos2++;
    }
  }
  if (tmp.size()) arr1.push_back(tmp);
}
vector<vector<int> > arr2;
vector<int> lrtmp, rltmp;
void mrg2() {
  lrtmp.clear();
  rltmp.clear();
  for (int i = 0; i < arr1.size(); i++) {
    if (S[arr1[i][0]] == 'L' && S[arr1[i].back()] == 'R') {
      for (int j = 0; j < arr1[i].size(); j++) {
        lrtmp.push_back(arr1[i][j]);
      }
    } else if (S[arr1[i][0]] == 'R' && S[arr1[i].back()] == 'L') {
      for (int j = 0; j < arr1[i].size(); j++) {
        rltmp.push_back(arr1[i][j]);
      }
    } else
      arr2.push_back(arr1[i]);
  }
  if (lrtmp.size() == 0 || rltmp.size() == 0) {
    if (lrtmp.size()) arr2.push_back(lrtmp);
    if (rltmp.size()) arr2.push_back(rltmp);
    return;
  }
  if (lrtmp.back() < rltmp.back()) {
    int t = rltmp.back();
    rltmp.erase(rltmp.end() - 1);
    lrtmp.push_back(t);
  } else {
    int t = lrtmp.back();
    lrtmp.erase(lrtmp.end() - 1);
    rltmp.push_back(t);
  }
  if (lrtmp.size()) arr2.push_back(lrtmp);
  if (rltmp.size()) arr2.push_back(rltmp);
}
int main() {
  cin >> S;
  for (int i = 0; i < S.size(); i++) {
    l.insert(i);
    if (S[i] == 'L')
      rl.insert(i);
    else
      rr.insert(i);
  }
  nxt = vector<int>(S.size(), -1);
  while (1) {
    if (l.empty()) break;
    int t = *l.begin();
    l.erase(l.begin());
    if (S[t] == 'L') {
      if (rr.upper_bound(t) == rr.end()) continue;
      int d = *rr.upper_bound(t);
      rr.erase(rr.upper_bound(t));
      nxt[t] = d;
    } else {
      if (rl.upper_bound(t) == rl.end()) continue;
      int d = *rl.upper_bound(t);
      rl.erase(rl.upper_bound(t));
      nxt[t] = d;
    }
  }
  int cnt = 0;
  chk = vector<int>(S.size(), 0);
  for (int i = 0; i < S.size(); i++) {
    if (chk[i]) continue;
    arr.push_back(vector<int>());
    int now = i;
    while (now != -1) {
      chk[now] = 1;
      arr.back().push_back(now);
      now = nxt[now];
    }
    cnt++;
  }
  mrg1();
  mrg2();
  arr = arr2;
  mrg1();
  if (arr1.size() == 2) {
    if (arr1[0][0] == arr1[1].back()) {
      for (int i = 0; i < arr1[0].size(); i++) {
        arr1[1].push_back(arr1[0][i]);
      }
      arr1.erase(arr1.end() - 2);
    } else {
      for (int i = 0; i < arr1[1].size(); i++) {
        arr1[0].push_back(arr1[1][i]);
      }
      arr1.erase(arr1.end() - 1);
    }
  }
  printf("%d\n", cnt - 1);
  for (int i = 0; i < arr1[0].size(); i++) {
    printf("%d ", arr1[0][i] + 1);
  }
}
