#include <bits/stdc++.h>
using namespace std;
string s, t;
double calc(string s) {
  int l = s.length(), p = 0, q = 0, cnt = 0, cur = 0;
  for (int i = 0; i < l; i++) {
    char ch = (q & 1) ? 'R' : 'L';
    if (s[i] == 'X')
      q++;
    else if (s[i] == ch) {
      p++;
      q++;
      cur = 0;
    } else {
      p++;
      q += 2;
      cnt += cur;
      cur = !cur;
    }
  }
  if (q & 1) {
    q++;
    cnt += cur;
  }
  if (p * 2 > q) {
    p -= cnt;
    q -= 2 * cnt;
  }
  return 1.0 * p / q;
}
int main() {
  cin >> s;
  t = "";
  int l = s.length();
  for (int i = 0; i < l - 1; i++) {
    t += s[i];
    if (s[i] == s[i + 1] && s[i] != 'X') t += 'X';
  }
  t += s[l - 1];
  double ans;
  if (t[0] == t[t.length() - 1] && t[0] != 'X')
    ans = max(calc(t + 'X'), calc('X' + t));
  else
    ans = calc(t);
  ans = floor(ans * 1e8) / 1e6;
  cout << fixed << setprecision(6) << ans << endl;
  return 0;
}
