import Data.Bool (bool)

main :: IO ()
main = do
  let
    xs = [3, 2, 1, 1, 2, 1, 1, 0]
  s <- map (== 'S') <$> getLine :: IO [Bool]
  print . (xs !!) . foldl (\i j -> 2 * i + j) 0 . map (bool 0 1) $ s
