#include <bits/stdc++.h>
using namespace std;
char s[2000005 >> 1], t[2000005], w[] = {'L', 'R'};
double check(int q) {
  int cur = 0, cnt = 0, p = 0, i = 0;
  while (t[i]) {
    if (t[i] == 'X')
      ++q;
    else if (t[i] == w[q & 1])
      ++p, ++q, cur = 0;
    else
      q += 2, ++p, cnt += cur, cur ^= 1;
    ++i;
  }
  if (q & 1) ++q, cnt += cur;
  if (p << 1 > q) p -= cnt, q -= (cnt << 1);
  return 1.0 * p / q;
}
int main() {
  scanf("%s", s);
  int i = 0, len = 0;
  t[0] = s[0];
  while (s[++i]) {
    if (s[i] == s[i - 1] && s[i] != 'X') t[++len] = 'X';
    t[++len] = s[i];
  }
  t[++len] = 0;
  if (t[0] == t[len - 1] && t[0] != 'X') {
    double a = check(1);
    t[len++] = 'X';
    t[len] = 0;
    printf("%.6f\n", floor(max(a, check(0)) * 1.0e8) / 1e6);
  } else
    printf("%.6f\n", floor(check(0) * 1e8) / 1e6);
  return 0;
}
