#include <bits/stdc++.h>
using namespace std;
double ans;
string a, c;
int i, tot;
void work(string a) {
  int i, l = a.length(), x = 0, y = 0, o = 0, flag = 0;
  for (i = 0; i < l; ++i) {
    char c = (i + y & 1) ? 'R' : 'L';
    if (a[i] == 'X') continue;
    if (a[i] == c) {
      x++;
      flag = 0;
    } else {
      x++;
      y++;
      o += flag;
      flag ^= 1;
    }
  }
  y += l;
  if (y & 1) y++, o += flag;
  if (x * 2 > y) {
    x -= o;
    y -= 2 * o;
  }
  ans = max(ans, 1. * x / y);
}
int main() {
  cin >> c;
  tot = c.length();
  for (i = 0; i < tot; ++i) {
    if (i != 0 && c[i] == c[i - 1] && c[i] != 'X') a += 'X';
    a += c[i];
  }
  if (a[0] == a[a.length() - 1] && a[0] != 'X')
    work("X" + a), work(a + "X");
  else
    work(a);
  ans = ans * 100000000 + 1e-7;
  printf("%d.%06d\n", (int)ans / 1000000, (int)ans % 1000000);
}
