#!/usr/bin/env python3
import sys
# input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return map(int,input().split())
def LI(): return list(map(int,input().split()))

def main():
    X = input()

    LENX = len(X)

    left_T = 0
    right_S = 0

    for i in range(LENX):
        if X[i] == "T":
            left_T += 1
        else:
            break
    
    for i in range(LENX-1,-1,-1):
        if X[i] == "S":
            right_S += 1
        else:
            break
    
    print(left_T+right_S)

    return

if __name__ == '__main__':
    main()
