結果

問題 No.2924 <===Super Spaceship String===>
ユーザー Yakumo221
提出日時 2024-10-12 15:02:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 644 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 102,664 KB
最終ジャッジ日時 2024-10-12 15:02:35
合計ジャッジ時間 1,477 ms
ジャッジサーバーID
(参考情報)
judge4 / judge
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 8 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()
n = len(s)

stack = []
equal = []
ans = n

for i in range(n):
    c = s[i]
    if c == "<":
        stack.append(i)
    elif c == "=":
        equal.append(i)
    elif c == ">":
        if stack:
            if stack[-1] == (i-1):
                stack = []
                equal = []
            else:
                l = stack.pop()
                cnt = 2
                while equal:
                    if l <= equal[-1] < i:
                        equal.pop()
                        cnt += 1
                    else:
                        break
                ans -= cnt
        else:
            equal = []

print(ans)
0