import java.util.Scanner;

class Solver{
    final String S;

    Solver(Scanner in){
        S = in.next();
    }

    void solve(){
        System.out.println((S.length() - S.lastIndexOf('T') - 1) * 2);
    }
}

class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);

        new Solver(in).solve();

        in.close();
    }
}