結果

問題 No.1894 Delete AB
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2022-04-08 22:23:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 176 ms / 2,000 ms
コード長 302 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 82,048 KB
最終ジャッジ日時 2024-05-06 07:55:47
合計ジャッジ時間 2,515 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
51,584 KB
testcase_01 AC 73 ms
76,928 KB
testcase_02 AC 75 ms
75,648 KB
testcase_03 AC 148 ms
76,672 KB
testcase_04 AC 144 ms
76,160 KB
testcase_05 AC 120 ms
76,288 KB
testcase_06 AC 176 ms
76,672 KB
testcase_07 AC 127 ms
76,416 KB
testcase_08 AC 131 ms
76,288 KB
testcase_09 AC 97 ms
76,160 KB
testcase_10 AC 97 ms
75,904 KB
testcase_11 AC 78 ms
75,520 KB
testcase_12 AC 78 ms
76,544 KB
testcase_13 AC 76 ms
82,048 KB
testcase_14 AC 68 ms
75,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #



T=int(input())
for _ in range(T):
    n=int(input())
    s=list(input())
    s.reverse()
    ans=[]
    for x in s:
        ans.append(x)
        if len(ans)>=3 and ans[-1]=="A" and ans[-2]=="B" and ans[-3]=="B":
            ans.pop()
            ans.pop()
    ans.reverse()
    print("".join(ans))
0