Problem: There is a sand trail in front of Alice's home.

In daytime, people walk over it and leave a footprint on the trail for their every single step. Alice cannot distinguish the order of the footprints, but she can tell whether each footprint is made by left foot or right foot. Also she's certain that all people are walking by alternating left foot and right foot.

For example, suppose that one person walked through the trail and left some footprints. The footprints are RRLRL in order along the trail ('R' means right foot and 'L' means left foot). You might think the outcome of the footprints is strange. But in fact, some steps are resulting from walking backwards!

There are some possible order of steps that produce these footprints such as 1 → 3 → 2 → 5 → 4 or 2 → 3 → 4 → 5 → 1 (we suppose that the distance between two consecutive steps can be arbitrarily long). The number of backward steps from above two examples are 2 and 1 separately.

Alice is interested in these footprints. Whenever there is a person walking trough the trail, she takes a picture of all these footprints along the trail and erase all of them so that next person will leave a new set of footprints. We know that people walk by alternating right foot and left foot, but we don't know if the first step is made by left foot or right foot.

Alice wants to know the minimum possible number of backward steps made by a person. But it's a little hard. Please help Alice to calculate it. You also need to construct one possible history of these footprints.

Input

Only one line containing the string S (1 ≤ |S| ≤ 100 000) containing all footprints in order along the trail from entrance to exit.

It is guaranteed that there is at least one possible footprint history.

Output

You should output 2 lines.

The first line should contain a number denoting the minimum number of backward steps.

The second line should contain a permutation of integers from 1 to |S|. This permutation should denote the order of footprints that may possible be used by person walked there.

If there are several possible answers, you may output any of them.

Examples

Input

RRLRL


Output

1
2 5 1 3 4


Input

RLRLRLRLR


Output

0
1 2 3 4 5 6 7 8 9


Input

RRRRRLLLL


Output

4
4 9 3 8 2 7 1 6 5

Note

For the first sample, one possible order is 2 → 5 → 1 → 3 → 4, among them only the step 5 → 1 is backward step so the answer is 1. 

For the second example one possible order is just to follow the order of input, thus there are no backward steps. 

For the third sample, there will be 4 backward steps because every step from L to R will be a backward step.

Solution (in CPP):

Solution:
#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);
  }
}