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>
bool chkmax(T &x, T y) {
  return x < y ? x = y, true : false;
}
template <typename T>
bool chkmin(T &x, T y) {
  return x > y ? x = y, true : false;
}
int readint() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n;
int f[100005][2], ct[2];
char s[100005];
vector<int> ans[100005];
int getf(int x, int t) { return x == f[x][t] ? x : f[x][t] = getf(f[x][t], t); }
void getans() {
  for (int i = 1; i <= n + 1; i++) f[i][0] = f[i][1] = i;
  for (int i = 1; i <= n; i++) {
    if (s[i] == 'L')
      f[getf(i, 0)][0] = getf(i + 1, 0);
    else
      f[getf(i, 1)][1] = getf(i + 1, 1);
  }
  int now = -1, cnt = 0, pl = 0;
  while (getf(1, 0) != getf(n, 0) || getf(1, 1) != getf(n, 1)) {
    cnt++, now = -1;
    for (int i = min(getf(1, 0), getf(1, 1)); i <= n; i = getf(i + 1, now)) {
      if (now < 0 || (s[i] == 'L') == now) {
        ans[cnt].push_back(i);
        if (now < 0) now = s[i] == 'L';
        f[getf(i, now)][now] = getf(i + 1, now);
        if (now >= 0)
          now ^= 1;
        else
          now = (s[i] == 'L') ^ 1;
      }
    }
  }
  printf("%d\n", cnt - 1);
  sort(ans + 1, ans + cnt + 1, [&](vector<int> x, vector<int> y) {
    if ((s[x[0]] == 'L') == (s[y[0]] == 'L')) {
      if (s[x[0]] == 'R')
        return (s[x[x.size() - 1]] == 'L') > (s[y[y.size() - 1]] == 'L');
      else
        return (s[x[x.size() - 1]] == 'L') < (s[y[y.size() - 1]] == 'L');
    }
    return (s[x[0]] == 'L') < (s[y[0]] == 'L');
  });
  int s0 = 1, s1 = 1, t1 = 0, sum = 0;
  while (s1 <= cnt && s[ans[s1][0]] == 'R') s1++;
  t1 = s1;
  if (ct[0] > ct[1])
    now = 0;
  else
    now = 1;
  if (ct[0] == ct[1]) {
    bool fl = 1;
    now = 0;
    while (sum < n) {
      if (now == 0) {
        if (s0 == t1) {
          fl = 0;
          break;
        }
        for (auto x : ans[s0]) sum++;
        if (s[ans[s0][ans[s0].size() - 1]] == 'R') now = 1;
        s0++;
      } else {
        if (s1 == cnt + 1) {
          fl = 0;
          break;
        }
        for (auto x : ans[s1]) sum++;
        if (s[ans[s1][ans[s1].size() - 1]] == 'L') now = 0;
        s1++;
      }
    }
    if (!fl) {
      now = 1, sum = 0, s0 = 1, s1 = t1;
      while (sum < n) {
        if (now == 0) {
          for (auto x : ans[s0]) printf("%d ", x), sum++;
          if (s[ans[s0][ans[s0].size() - 1]] == 'R') now = 1;
          s0++;
        } else {
          for (auto x : ans[s1]) printf("%d ", x), sum++;
          if (s[ans[s1][ans[s1].size() - 1]] == 'L') now = 0;
          s1++;
        }
      }
    } else {
      now = 0, sum = 0, s0 = 1, s1 = t1;
      while (sum < n) {
        if (now == 0) {
          for (auto x : ans[s0]) printf("%d ", x), sum++;
          if (s[ans[s0][ans[s0].size() - 1]] == 'R') now = 1;
          s0++;
        } else {
          for (auto x : ans[s1]) printf("%d ", x), sum++;
          if (s[ans[s1][ans[s1].size() - 1]] == 'L') now = 0;
          s1++;
        }
      }
    }
  } else {
    while (sum < n) {
      if (now == 0) {
        for (auto x : ans[s0]) printf("%d ", x), sum++;
        if (s[ans[s0][ans[s0].size() - 1]] == 'R') now = 1;
        s0++;
      } else {
        for (auto x : ans[s1]) printf("%d ", x), sum++;
        if (s[ans[s1][ans[s1].size() - 1]] == 'L') now = 0;
        s1++;
      }
    }
  }
  printf("\n");
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  if (n == 1) return printf("0\n1\n"), 0;
  for (int i = 1; i <= n; i++) ct[s[i] == 'L']++;
  getans();
  return 0;
}