#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[1000001];
  scanf("%s", s);
  char a[2] = {'L', 'R'};
  int n = strlen(s);
  int len = 0;
  int cnt = 0;
  int cont = 0;
  int pair = 0;
  int cont_ini = 0;
  bool flag = true;
  for (int i = 0; i < n; i++) {
    if (s[i] != 'X') {
      if (cont > 1) flag = true;
      cnt++;
      if (a[len % 2] == s[i]) {
        cont++;
      } else {
        if (cont_ini == 0) cont_ini = cont;
        if ((cont == 1) && (flag)) pair++;
        if (cont == 1) flag = (!flag);
        cont = 1;
        len++;
      }
      if (s[i] == s[i + 1]) len++;
    }
    len++;
  }
  if ((s[n - 1] == 'L') && (s[0] == 'L')) {
    len++;
  }
  if ((s[n - 1] == 'R') && (s[0] == 'R')) {
    if (len % 2)
      len++;
    else if (cont_ini == 1)
      pair--;
  }
  if (len % 2) {
    if ((cont == 1) && (flag)) pair++;
    len++;
  }
  double ans = max(double(cnt) / double(len),
                   double(cnt - pair) / double(len - 2 * pair));
  printf("%.6f\n", double(int(ans * 100000000)) / 1000000);
  return 0;
}
