結果

問題 No.2924 <===Super Spaceship String===>
ユーザー ルク
提出日時 2024-10-12 14:59:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 151 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 188 ms
コンパイル使用メモリ 82,276 KB
実行使用メモリ 124,988 KB
最終ジャッジ日時 2024-10-16 17:53:35
合計ジャッジ時間 1,692 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

s=input()
r=[]
for i in range(len(s)):
  if s[i]=="<":
    r.append(["<",1])
  elif s[i]=="=":
    if len(r)==0:
      r.append(["=",1])
    elif r[-1][0]=="=":
      r[-1][1]+=1
    else:
      r.append(["=",1])
  else:
    if len(r)>1:
      if r[-1][0]=="=" and r[-2][0]=="<":
        r.pop()
        r.pop()
      else:
        r.append([">",1])
    else:
      r.append([">",1])
ans=0
for x in r:
  ans+=x[1]
print(ans)
0