結果
| 問題 |
No.2924 <===Super Spaceship String===>
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-28 13:33:45 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 117 ms / 2,000 ms |
| コード長 | 556 bytes |
| コンパイル時間 | 500 ms |
| コンパイル使用メモリ | 82,692 KB |
| 実行使用メモリ | 122,020 KB |
| 最終ジャッジ日時 | 2025-04-28 13:33:47 |
| 合計ジャッジ時間 | 2,433 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 12 |
ソースコード
import sys
def input():
return sys.stdin.readline().strip()
def main():
s = input()
z = []
noneq = []
for c in s:
if (
c == ">"
and len(z) > 0
and z[-1] == "="
and len(noneq) > 0
and noneq[-1] == "<"
):
while z[-1] == "=":
z.pop()
z.pop()
noneq.pop()
else:
z.append(c)
if c != "=":
noneq.append(c)
print(len(z))
if __name__ == "__main__":
main()