var
i,t,x:longint;
s:ansistring;
begin
readln(s);
t:=length(s);
x:=0;
for i:=1 to length(s) do
  if s[i]='S' then inc(x)
    else
      begin
        x:=x-1;
        t:=t-2;
      end;
writeln(t);
end.