X = input()

Y = X[::-1]

ans = 0

for x in X:
    if x == 'T':
        ans += 1
    else:
        break
for y in Y:
    if y == 'S':
        ans += 1
    else:
        break

if ans % 2 == 0:
    print(ans)
else:
    print(ans + 1)
