#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using uint = unsigned int;
using vi = vector<int>;
using pii = pair<int, int>;
inline int prev(int ind, int len) {
  ind--;
  return ind < 0 ? ind + len : ind;
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  string s;
  cin >> s;
  int n = (int)((s).size());
  string t;
  int pos = 0;
  vi v;
  string need = "LR";
  for (int i = 0; i < (n); ++i) {
    if (s[i] != 'X' && s[i] != need[(int)((t).size()) % 2]) {
      t += 'X';
      if (s[i] != s[prev(i, n)]) v.push_back(pos);
    }
    if (s[i] != 'X') pos++;
    t += s[i];
  }
  if ((int)((t).size()) % 2) {
    if (s[0] != s[n - 1] || s[0] == 'R') v.push_back(pos);
    t += 'X';
  }
  int m = (int)((t).size());
  int match = 0, len = m;
  for (int i = 0; i < (m); ++i) {
    match += (t[i] != 'X' && t[i] == need[i % 2]);
  }
  for (int i = 0; i < ((int)((v).size()) - 1); ++i) {
    if (2 * match > len && v[i] == v[i + 1] - 1) match--, len -= 2, i++;
  }
  int r = match * 100000000ll / len;
  printf("%d.%06d", r / 1000000, r % 1000000);
  return 0;
}
