def sol():
    X = input()
    leftT = 0
    while X[leftT] == 'T':
        leftT += 1

    rightS = 0
    while X[len(X) - rightS - 1] == 'S':
        rightS += 1

    if leftT == 0 and rightS == 0:
        print(0)
    else:
        print(leftT + rightS + 1)

sol()