Submission #904301


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define forn(i, a, n) for (int i = a; i < n; ++i)
#define ford(i, a, n) for (int i = n - 1; i >= a; --i)
#define fore(i, a, n) for (int i = a; i <= n; ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
    for (auto i : a) cerr << i << ' ';\
    cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    stack<char> q;
    for (char c : s) {
        if (!q.empty() && q.top() == 'S' && c == 'T') q.pop();
        else q.push(c);
    }
    cout << q.size() << '\n';
}

Submission Info

Submission Time
Task A - STring
User khadaev
Language C++14 (GCC 5.4.1)
Score 300
Code Size 910 Byte
Status AC
Exec Time 4 ms
Memory 720 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 4 ms 720 KB
corner1 AC 4 ms 720 KB
corner2 AC 4 ms 720 KB
example0 AC 3 ms 256 KB
example1 AC 3 ms 256 KB
example2 AC 3 ms 256 KB
handmade0 AC 3 ms 256 KB
handmade1 AC 3 ms 256 KB
maxrand0 AC 4 ms 720 KB
sub_corner0 AC 3 ms 256 KB
sub_corner1 AC 3 ms 256 KB
sub_corner2 AC 3 ms 256 KB
sub_rand0 AC 3 ms 256 KB