let printf = Printf.printf
let scanf = Scanf.scanf

let () =
  scanf "%s" (fun x ->
      let rec go acc i =
        if i = String.length x then acc else
          let ch = String.get x i in
          if ch == 'S' then
            go (ch :: acc) (i + 1)
          else
            match acc with
            | [] -> go (ch :: acc) (i + 1)
            | hd::tl ->
              if hd == 'S' then
                go tl (i + 1)
              else
                go (ch :: acc) (i + 1)
      in
      let result = go [] 0 in
      printf "%d" (List.length result))
