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;
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
const int oo = 0x3f3f3f3f;
const int maxn = 200000;
int n, m;
char s[maxn + 5];
vector<vector<int> > now;
int fir[maxn + 5], lst[maxn + 5];
set<int> L, R;
vector<int> LL, RR, LR, RL;
int nxt[maxn + 5], pre[maxn + 5];
inline void doit(const vector<int> &v) {
  for (int i = (0), _end_ = ((int((v).size())) - 1); i < _end_; ++i)
    nxt[v[i]] = v[i + 1], pre[v[i + 1]] = v[i], assert(s[v[i]] != s[v[i + 1]]);
}
inline void print() {
  for (int i = (0), _end_ = (n); i < _end_; ++i)
    if (pre[i] == -1) {
      int u = i;
      while (u != -1) {
        printf("%d ", u + 1);
        u = nxt[u];
      }
      break;
    }
}
int main() {
  scanf("%s", s);
  n = strlen(s);
  int sum = 0, Min = 0, Max = 0;
  for (int i = 0; s[i]; ++i) {
    if (s[i] == 'L')
      --sum;
    else
      ++sum;
    if (sum > Max || sum < Min) {
      chkmax(Max, sum);
      chkmin(Min, sum);
      if (s[i] == 'L')
        L.insert((int((now).size())));
      else
        R.insert((int((now).size())));
      now.push_back(vector<int>(1, i));
    } else {
      int cur = 0;
      if (s[i] == 'L')
        cur = *R.begin();
      else
        cur = *L.begin();
      now[cur].push_back(i);
      if (L.count(cur))
        L.erase(cur), R.insert(cur);
      else
        R.erase(cur), L.insert(cur);
    }
  }
  memset(nxt, -1, sizeof nxt);
  memset(pre, -1, sizeof pre);
  printf("%d\n", Max - Min - 1);
  for (int i = (0), _end_ = ((int((now).size()))); i < _end_; ++i) {
    bool tmp0 = s[now[i][0]] == 'L',
         tmp1 = s[((now[i])[(int((now[i]).size())) - 1])] == 'L';
    if (tmp0 && tmp1)
      LL.push_back(i);
    else if (tmp0)
      LR.push_back(i);
    else if (tmp1)
      RL.push_back(i);
    else
      RR.push_back(i);
  }
  m = (int((now).size()));
  for (int i = (0), _end_ = (m); i < _end_; ++i) {
    doit(now[i]);
    fir[i] = now[i][0];
    lst[i] = ((now[i])[(int((now[i]).size())) - 1]);
  }
  for (int i = (1), _end_ = ((int((LR).size()))); i < _end_; ++i) {
    int first = lst[LR[i - 1]];
    int second = fir[LR[i]];
    nxt[first] = second;
    pre[second] = first;
    assert(s[first] != s[second]);
    lst[LR[0]] = lst[LR[i]];
  }
  for (int i = (1), _end_ = ((int((RL).size()))); i < _end_; ++i) {
    int first = lst[RL[i - 1]];
    int second = fir[RL[i]];
    nxt[first] = second;
    pre[second] = first;
    assert(s[first] != s[second]);
    lst[RL[0]] = lst[RL[i]];
  }
  if ((int((RL).size())) && (int((LR).size()))) {
    int tmp0 = lst[((LR)[(int((LR).size())) - 1])];
    int tmp1 = lst[((RL)[(int((RL).size())) - 1])];
    int first = LR[0];
    int second = RL[0];
    LL.push_back(first);
    RR.push_back(second);
    LR.clear();
    RL.clear();
    if (tmp0 < tmp1) swap(tmp0, tmp1), swap(first, second);
    lst[first] = pre[tmp0];
    lst[second] = tmp0;
    assert(s[tmp0] != s[tmp1]);
    pre[tmp0] = tmp1;
    nxt[tmp1] = tmp0;
  } else {
    if (!(int((LL).size())) && !(int((RR).size()))) {
      print();
      return 0;
    } else if ((int((LR).size())) || (int((RL).size()))) {
      if (((int((LR).size())) && (int((LL).size())))) {
        int first = lst[LR[0]], second = fir[LL[0]];
        assert(s[first] != s[second]);
        nxt[first] = second;
        pre[second] = first;
        lst[LR[0]] = lst[LL[0]];
        LL[0] = LR[0];
      } else if (((int((LL).size())) && (int((RL).size())))) {
        int first = fir[RL[0]], second = lst[LL[0]];
        assert(s[first] != s[second]);
        nxt[second] = first;
        pre[first] = second;
        lst[LL[0]] = lst[RL[0]];
      } else if (((int((RL).size())) && (int((RR).size())))) {
        int first = lst[RL[0]], second = fir[RR[0]];
        assert(s[first] != s[second]);
        nxt[first] = second;
        pre[second] = first;
        lst[RL[0]] = lst[RR[0]];
        RR[0] = RL[0];
      } else if (((int((RR).size())) && (int((LR).size())))) {
        int first = fir[LR[0]], second = lst[RR[0]];
        assert(s[first] != s[second]);
        nxt[second] = first;
        pre[first] = second;
        lst[RR[0]] = lst[LR[0]];
      }
    }
  }
  int lyc = -1;
  bool cur = (int((LL).size())) > (int((RR).size()));
  while ((int((LL).size())) || (int((RR).size()))) {
    int first = -1;
    if (cur)
      first = ((LL)[(int((LL).size())) - 1]), LL.pop_back();
    else
      first = ((RR)[(int((RR).size())) - 1]), RR.pop_back();
    assert(s[fir[first]] != s[lyc]);
    pre[fir[first]] = lyc;
    if (lyc >= 0) nxt[lyc] = fir[first];
    lyc = lst[first];
    cur = !cur;
  }
  print();
  return 0;
}