結果

問題 No.2924 <===Super Spaceship String===>
ユーザー うにれ
提出日時 2024-10-12 15:22:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 355 bytes
コンパイル時間 198 ms
コンパイル使用メモリ 82,588 KB
実行使用メモリ 78,012 KB
最終ジャッジ日時 2024-10-16 17:54:23
合計ジャッジ時間 1,458 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
mod = 998244353
mod2 = 10**9+7

S = input()
left = []
deled = 0
for i in range(len(S)):
    ni = i-deled
    if S[i] == "<":
        left.append(ni)
    if S[i] == ">":
        if len(left) == 0:continue
        if left[-1] + 1 == ni:
            left = []
            continue
        l = left.pop()
        deled += ni-l+1
print(len(S)-deled)
0