結果

問題 No.1894 Delete AB
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2022-04-08 22:23:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 155 ms / 2,000 ms
コード長 302 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 87,188 KB
実行使用メモリ 87,380 KB
最終ジャッジ日時 2023-08-19 00:52:51
合計ジャッジ時間 2,508 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
71,524 KB
testcase_01 AC 83 ms
86,244 KB
testcase_02 AC 79 ms
86,020 KB
testcase_03 AC 133 ms
78,900 KB
testcase_04 AC 137 ms
78,916 KB
testcase_05 AC 110 ms
77,528 KB
testcase_06 AC 155 ms
78,176 KB
testcase_07 AC 115 ms
77,376 KB
testcase_08 AC 120 ms
77,500 KB
testcase_09 AC 91 ms
77,628 KB
testcase_10 AC 93 ms
77,424 KB
testcase_11 AC 80 ms
76,896 KB
testcase_12 AC 77 ms
78,156 KB
testcase_13 AC 78 ms
87,380 KB
testcase_14 AC 78 ms
86,508 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