結果

問題 No.1894 Delete AB
ユーザー ShirotsumeShirotsume
提出日時 2022-04-08 00:15:25
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 528 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 81,664 KB
実行使用メモリ 77,056 KB
最終ジャッジ日時 2024-05-06 00:54:14
合計ジャッジ時間 4,450 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
57,344 KB
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())

def solve():
    n = ii()
    s = list(input())

    while True:
        flag = True
        for i in range(len(s) - 2):
            if s[i] == 'A' and s[i + 1] == 'B' and s[i + 2] == 'B':
                s.pop(i)
                s.pop(i)
                flag = False
                break
        if flag:
            break
    print(''.join(s))

for _ in range(ii()):
    solve()
0