func :: String -> Int ->Int-> Int
func [] now prev = max now prev
func ('S':str) now prev = func str 0 (now `max` prev)
func ('R':str) now prev = func str (now+1) prev

main :: IO ()
main = do
  line <- getLine
  print $ func line 0 0