fun readStrWithoutWS () = let val sOption = TextIO.inputLine TextIO.stdIn in case sOption of NONE => "" | SOME s => String.implode (List.filter (fn c => Char.isAlphaNum c) (String.explode s)) end val () = let val s = readStrWithoutWS () val ans = if String.size s = 0 then 1 else ( List.foldl (fn (ch, acc) => if ch = #"L" then acc * 2 else acc * 2 + 1) 1 (String.explode s) ) in print (Int.toString ans ^ "\n") end