import Control.Monad
import Control.Applicative
import Data.List

main :: IO ()
main = do
  input <- getLine
  -- let n = read input ::Int  
  let u = max 5 7
  let ans = show (snd (solve input))
  putStrLn ans

solve :: String -> (Int,Int)
solve s = if (length(s)==0) then (0,0) 
  else if (head(s)=='S') then (0,snd(solve(tail(s))))
  else ( 
    let aaa = solve(tail(s)) in  (fst(aaa)+1,(max (fst(aaa)+1) (snd aaa)))
  )






