import sys
X = list(sys.stdin.readline().strip())
N = len(X)

def solve2():
    trailing = 0
    i = N-1
    while i >= 0 and X[i] == 'S':
        trailing += 1
        i -= 1
    return trailing * 2

print(solve2())