// [16 Oct 2005, by yuizumi] // Fixed a bug that does not properly process the case containing no 'R's. import java.io.*; public class geometry_yuizumi { private static double compute(String line) { double xmax = 0.0; double ymax = 0.0; for(int i = 0; i < line.length(); i++) { if(line.charAt(i) == 'R') { xmax += 1.0; } if(line.charAt(i) == 'U') { ymax += 1.0; } } if(xmax == 0.0) return 0.0; double x = 0.0; double y = 0.0; double S = 0.0; for(int i = 0; i < line.length(); i++) { if(line.charAt(i) == 'R') { double xL = x + 0.0; double xR = x + 1.0; double yL = y * xmax - xL * ymax; double yR = y * xmax - xR * ymax; if(yL * yR < 0.0) { S += (yL * yL + yR * yR) / Math.abs(yL - yR); } else { S += Math.abs(yL + yR); } x += 1.0; } else { y += 1.0; } } return S / (2.0 * xmax); } public static void main(String[] args) throws Exception { BufferedReader br = null; try { br = new BufferedReader(new InputStreamReader(System.in)); while(true) { String line = br.readLine(); line = line.substring(0, line.length() - 1); if(line.length() == 0) { break; } System.out.println(compute(line)); } } finally { if(br != null) br.close(); } } }