using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionE
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 文字列の入力
            string s = Console.ReadLine();

            var length = s.Length;

            var index = s.LastIndexOf('T');

            var sNum = length - index - 1;

            Console.WriteLine(sNum * 2);

            Console.Out.Flush();
        }
    }
}
