#include <bits/stdc++.h>
using namespace std;
inline long double solve(string str) {
  int p = 0, q = 0, nr = 0, ok = 0;
  for (char ch : str) {
    char aux = (q & 1) ? 'R' : 'L';
    if (ch == 'X')
      ++q;
    else if (ch == aux) {
      ++p;
      ++q;
      ok = 0;
    } else if (ch != aux) {
      ++p;
      q += 2;
      nr += ok;
      ok = 1 - ok;
    }
  }
  if (q & 1) {
    ++q;
    nr += ok;
  }
  if ((p << 1) > q) {
    p -= nr;
    q -= (nr << 1);
  }
  return (long double)p / q;
}
int main(void) {
  string aux, str;
  cin >> aux;
  for (int i = 0; i < aux.size(); ++i) {
    if (i > 0 and aux[i] == aux[i - 1] and aux[i - 1] != 'X')
      str.push_back('X');
    str.push_back(aux[i]);
  }
  long double ans;
  if (str.front() == str.back() and str.front() != 'X')
    ans = max(solve('X' + str), solve(str + 'X'));
  else
    ans = solve(str);
  cout << setprecision(6) << fixed << floor(ans * 1e8) / 1e6;
  return 0;
}
