X = input()


tmp = ""
while "ST" in X:
    for i in range(len(X)-1):
        if X[i] == "S" and X[i+1] == "T":
            for j in range(i):
                tmp = tmp + X[j]
            if i != (len(X)-1):
                for j in range(i+1+1,len(X)):
                    tmp = tmp + X[j]
        X = tmp
        tmp = ""
        print(X)
        print(tmp)
        break
    print(X)