using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;

class Magatro
{

    static void Main()
    {
        string S = Console.ReadLine();
        int cnt = 0;
        for(int i = S.Length - 1; i >= 0; i--)
        {
            if (S[i] == 'S')
            {
                cnt++;
            }
            else
            {
                break;
            }
        }
        Console.WriteLine(cnt * 2);
    }

}
