# -*- coding: utf-8 -*-
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
import copy
import math
from itertools import accumulate
sys.setrecursionlimit(10**6)

# lis_of_lis = [[] for _ in range(N)]


def zz(): return list(map(int, sys.stdin.readline().split()))


def z(): return int(sys.stdin.readline())


def S(): return sys.stdin.readline()[:-1]


def C(line): return [sys.stdin.readline() for _ in range(line)]


X = S()
num_S = [0] * len(X)
s_count = 0
t_count = 0
for x in reversed(X):
    if (x == 'S'):
        s_count += 1
    else:
        break
        t_count += 1
print(s_count*2)


# for i, x in enumerate(X):
#     if(x == 'S'):
#         num_S[i] = 1

# num_S = list(accumulate(num_S))
# print(num_S)
