#include <bits/stdc++.h>
const int MAX_N = (int)1e5 + 123;
const double eps = 1e-6;
const int inf = (int)1e9 + 123;
using namespace std;
string second;
int nt[MAX_N];
set<int> r, l;
bool u[MAX_N];
vector<int> ans;
int cnt;
vector<vector<int> > q[4];
vector<vector<int> > all, all2;
void out(vector<vector<int> > &all) {
  for (auto i : all)
    for (auto j : i) cout << j + 1 << ' ';
  exit(0);
}
void solve() {
  if (all.empty() || all2.empty()) {
    if (!all2.empty()) all = all2;
    out(all);
  }
  if (second[all[0][0]] != second[all2.back().back()]) swap(all2, all);
  if (second[all.back().back()] != second[all2[0][0]]) {
    for (auto i : all2) all.push_back(i);
    out(all);
  }
  if (all.back().back() >= all2.back().back()) swap(all, all2);
  all.back().push_back(all2.back().back());
  all2.back().pop_back();
  for (auto i : all2) all.push_back(i);
  out(all);
}
int main() {
  cin >> second;
  for (int i = 0; i < int((second).size()); i++) {
    if (second[i] == 'R')
      r.insert(i);
    else
      l.insert(i);
  }
  for (int i = 0; i < int((second).size()); i++) {
    if (second[i] == 'L') {
      nt[i] = -1;
      if (!r.empty()) {
        nt[i] = *r.begin();
        r.erase(r.begin());
      }
      if (!l.empty() && *l.begin() == i) l.erase(l.begin());
    } else {
      nt[i] = -1;
      if (!l.empty()) {
        nt[i] = *l.begin();
        l.erase(l.begin());
      }
      if (!r.empty() && *r.begin() == i) r.erase(r.begin());
    }
  }
  for (int i = 0; i < int((second).size()); i++) {
    if (u[i]) continue;
    cnt++;
    int now = i;
    ans.clear();
    while (1) {
      u[now] = 1;
      ans.push_back(now);
      if (nt[now] == -1) break;
      now = nt[now];
    }
    if (second[i] == 'L' && second[now] == 'L') q[0].push_back(ans);
    if (second[i] == 'L' && second[now] == 'R') q[1].push_back(ans);
    if (second[i] == 'R' && second[now] == 'L') q[2].push_back(ans);
    if (second[i] == 'R' && second[now] == 'R') q[3].push_back(ans);
  }
  assert(abs(int((q[0]).size()) - int((q[3]).size())) <= 1);
  cout << cnt - 1 << endl;
  int last = 0;
  if (int((q[0]).size()) < int((q[3]).size())) {
    last = 3;
    swap(q[0], q[3]);
  }
  for (int i = 0; i < int((q[0]).size()); i++) {
    all.push_back(q[0][i]);
    if (i < int((q[3]).size())) all.push_back(q[3][i]);
  }
  if (q[1].empty() || q[2].empty()) {
    if (q[1].empty())
      all2 = q[2];
    else
      all2 = q[1];
    solve();
  }
  if (q[1].back().back() >= q[2].back().back()) {
    q[2].back().push_back(q[1].back().back());
    q[1].back().pop_back();
    swap(q[1], q[2]);
  } else {
    q[1].back().push_back(q[2].back().back());
    q[2].back().pop_back();
  }
  all2 = q[1];
  for (auto i : q[2]) all2.push_back(i);
  solve();
  return 0;
}
