#include <bits/stdc++.h>
using namespace std;
int cond = 1;
const int M = 1001013;
char s[M];
int d[M], z[M], czy[M];
int main() {
  scanf("%s", s);
  int x = 0, n = 0;
  d[0] = 2;
  if (s[0] == 'R' && s[strlen(s) - 1] == 'R') d[0]++, n++;
  for (int i = 0; s[i]; i++)
    if (s[i] == 'X')
      d[x]++, n++;
    else {
      ++x;
      d[x] = 1;
      n++;
      z[x] = s[i] == 'R';
      if (z[x - 1] == z[x] && d[x - 1] == 1) d[x - 1]++, n++;
      if ((z[x - 1] + d[x - 1]) % 2 != z[x]) czy[x] = 1, n++;
    }
  if (s[0] == 'L' && z[x] == 0 && d[x] == 1) d[x]++, n++;
  if (n % 2) czy[x + 1] = 1, n++;
  if (2 * x > n) {
    int xx = x;
    for (int i = 0; i < (x + 1); i++)
      if (czy[i] && czy[i + 1]) {
        xx--, n -= 2;
        czy[i] = czy[i + 1] = 0;
      }
    x = xx;
  }
  long long ret = x;
  ret *= 100000000;
  ret /= n;
  printf("%d.%06d\n", (int)(ret / 1000000), (int)(ret % 1000000));
  return 0;
}
