<?php
error_reporting(0);
$stdin = file_get_contents('php://stdin');
$line = explode("\n",$stdin);
$fi = 0;
$cnt = 0;
$list = array();
$key = new stdclass();
foreach($line as $l) {
  if (strlen($l)==0) continue;
  if ($fi == 0) {
    $a = explode(" ",$l);
    $key->A[] = $a[0];
    $fi++;
    continue;
  }
  if ($fi > 0) {
    break;
    $a = explode(" ",$l);
    $key->A[] = $a[0];
  }
}
$tgt = $key->A[0];
while(1) {
  $v = strpos($tgt,'ST');
  if ($v === false) break;
  $tgt = str_replace('ST','',$tgt);
}
printf("%d\n",strlen($tgt));
