#include<bits/stdc++.h>
#define endl enjoy_codeforces
int main(){
    std::string s;std::cin>>s;
    int now=0,min=0;
    for(char c:s){
        now+=c=='S'?+1:-1;
        if(now<min)min=now;
    }
    std::cout<<now-2*min<<'\n';
}
