#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 25;
const int MOD = 1e9+7;
 
int main() {
	string x;
	cin >> x;
	int n = x.size();

	stack<char> s;
	int cnt = 0;
	rep(i,n) {
		if (x[i] == 'S') s.push(x[i]);
		if (x[i] == 'T' && s.empty()) s.push(x[i]);
		if (x[i] == 'T' && s.top() == 'S') {
			s.pop();
			cnt += 2;
		}
	} 
	cout << n-cnt << endl;
	return 0;
}
#include <bits/stdc++.h>

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
typedef vector < vector<ll> > Mat;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

bool ans[60];

int main(){
  ll N; cin >> N;

  for (int i = 0; i < 60; i++){
    ll now = (ll) 1 << (i + 1);
    if (N % now != 0){
      ans[i] = true;
      if (i % 2 == 0) N -= now / 2;
      else N += now / 2;
    }

    if (N == 0){
      for (int j = i; j >= 0; j--) cout << ans[j];
      cout << endl;
      return 0;
    }
  }


  return 0;
}
