結果
| 問題 |
No.672 最長AB列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-05 20:31:33 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 218 bytes |
| コンパイル時間 | 164 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 94,720 KB |
| 最終ジャッジ日時 | 2024-10-06 23:01:11 |
| 合計ジャッジ時間 | 2,273 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 WA * 6 |
ソースコード
S=input().rstrip()
N=len(S)
res=0
c=dict()
A,B=0,0
for i in range(N):
s=S[i]
if s=="A":
A+=1
else:
B+=1
if A-B in c:
res=max(i-c[A-B],res)
else:
c[A-B]=i
print(res)