結果
| 問題 | No.559 swapAB列 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-10-09 23:27:42 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 25 ms / 2,000 ms |
| コード長 | 276 bytes |
| 記録 | |
| コンパイル時間 | 380 ms |
| コンパイル使用メモリ | 85,248 KB |
| 実行使用メモリ | 52,096 KB |
| 最終ジャッジ日時 | 2026-05-12 07:03:30 |
| 合計ジャッジ時間 | 1,295 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 |
ソースコード
def solve():
s = input()
cntA = s.count("A")
ans = 0
while s[:cntA].count("A") != cntA:
bl = s.rfind("B")
ar = s.rfind("A")
ans += len(s) - bl - 1
s = s[:bl] + s[bl+1:ar+1]
print(ans)
if __name__=="__main__":
solve()