Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

X = list(input())
num = len(X)
stack = []

for i in X:
    if i == "S":
        stack.append(i)
    else:
        if stack[-1] == "T" or stack[0] == "":
            stack.append(i)
        else:
            stack.pop()
print(len(stack))


Fixed submission:
# coding: utf-8
# Your code here!

X = list(input())
num = len(X)
stack = []

for i in X:
    if i == "S":
        stack.append(i)
    else:
        if stack == [] or stack[-1] == "T":
            stack.append(i)
        else:
            stack.pop()
print(len(stack))

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

X = list(input())
num = len(X)
stack = [X[0]]

for i in range(1, num):
    if X[i] == "S":
        stack.append("S")
    else:
        if stack[-1] == "T" or stack[0] == "":
            stack.append("T")
        else:
            stack.pop(-1)
print(len(stack))


Fixed submission:
# coding: utf-8
# Your code here!

X = list(input())
num = len(X)
stack = []

for i in X:
    if i == "S":
        stack.append(i)
    else:
        if stack == [] or stack[-1] == "T":
            stack.append(i)
        else:
            stack.pop()
print(len(stack))

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!

X = input()
num = pow(10, 100000)
ctr = 0

for i in range(num):
    if 'ST' in X:
        X = X.replace('ST', '')
    else:
        break
print(len(X))

Fixed submission:
# coding: utf-8
# Your code here!

X = list(input())
num = len(X)
stack = []

for i in X:
    if i == "S":
        stack.append(i)
    else:
        if stack == [] or stack[-1] == "T":
            stack.append(i)
        else:
            stack.pop()
print(len(stack))

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!

X = input()
num = pow(10, 100000)
ctr = 0

for i in range(num):
    if 'ST' in X:
        X = X.replace('ST', '')
    else:
        break
print(len(X))

Fixed submission:
# coding: utf-8
# Your code here!

X = list(input())
num = len(X)
stack = []

for i in X:
    if i == "S":
        stack.append(i)
    else:
        if stack == [] or stack[-1] == "T":
            stack.append(i)
        else:
            stack.pop()
print(len(stack))

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!

X = input()
num = pow(10, 100000)
ctr = 0

for i in range(num):
    if 'ST' in X:
        X = X.replace('ST', '', 1)
    else:
        break
print(len(X))

Fixed submission:
# coding: utf-8
# Your code here!

X = list(input())
num = len(X)
stack = []

for i in X:
    if i == "S":
        stack.append(i)
    else:
        if stack == [] or stack[-1] == "T":
            stack.append(i)
        else:
            stack.pop()
print(len(stack))

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!

X = input()
num = pow(10, 100000)
ctr = 0

for i in range(num):
    if 'ST' in X:
        X = X.replace('ST', '', 1)
    else:
        break
print(len(X))

Fixed submission:
# coding: utf-8
# Your code here!

X = list(input())
num = len(X)
stack = []

for i in X:
    if i == "S":
        stack.append(i)
    else:
        if stack == [] or stack[-1] == "T":
            stack.append(i)
        else:
            stack.pop()
print(len(stack))