chomp($line = <>);
if(index($line, 'T') == -1){
	printf length($line) . "\n";
}else{
	if(rindex($line, 'T') + 1 == length($line)){
		$left = $line;
		$right = "";
	}elsif(rindex($line, 'T') == 0){
		printf length($line) . "\n";
		exit;
	}else{
		$left = substr($line, 0, rindex($line, 'T') + 1);
		$right = substr($line, rindex($line, 'T') + 1, length($line));
	}
	$t = ($left =~ tr/S//);
	printf (length($left) - ($t * 2) + length($right)) . "\n";
}
