using System;

    class Program
    {
        static void Main(string[] args)
        {
            string sRead = Console.ReadLine();
            string sWrite = string.Empty;

            for(int i = 0; i < sRead.Length; i++)
            {
                if(sRead[0].Equals("S"))
                {
                    sWrite += sRead[0].ToString();
                    sRead = sRead.Remove(0, 1);
                }
                else
                {
                    if(sWrite.Length == 0 || sWrite[0].ToString() == "T")
                    {
                        sWrite += sRead[0].ToString();
                        sRead = sRead.Remove(0, 1);
                    }
                    else
                    {
                        sWrite.Remove(0,1);
                        sRead = sRead.Remove(0, 1);
                    }
                }
            }
            Console.WriteLine(sWrite);
        }
    }
