Submission #1604964


Source Code Expand

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")


def main():
    X = input()

    ans, s = 0, 0
    for i in range(len(X)):
        if X[i] == "S":
            s += 1
        elif X[i] == "T" and s > 0:
            s -= 1
            ans += 2
    print(len(X) - ans)


if __name__ == '__main__':
    main()

Submission Info

Submission Time
Task A - STring
User MitI_7
Language Python (3.4.3)
Score 300
Code Size 530 Byte
Status AC
Exec Time 54 ms
Memory 3880 KB

Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 200 / 200 100 / 100
Status
AC × 3
AC × 9
AC × 13
Set Name Test Cases
Sample example0, example1, example2
Subtask1 example0, example1, example2, sub_corner0, sub_corner1, sub_corner2, sub_rand0, handmade0, handmade1
All corner0, corner1, corner2, example0, example1, example2, handmade0, handmade1, maxrand0, sub_corner0, sub_corner1, sub_corner2, sub_rand0
Case Name Status Exec Time Memory
corner0 AC 54 ms 3880 KB
corner1 AC 43 ms 3880 KB
corner2 AC 48 ms 3880 KB
example0 AC 20 ms 3316 KB
example1 AC 20 ms 3316 KB
example2 AC 20 ms 3316 KB
handmade0 AC 20 ms 3316 KB
handmade1 AC 21 ms 3316 KB
maxrand0 AC 51 ms 3880 KB
sub_corner0 AC 21 ms 3316 KB
sub_corner1 AC 21 ms 3316 KB
sub_corner2 AC 20 ms 3316 KB
sub_rand0 AC 22 ms 3316 KB