結果
問題 | No.2924 <===Super Spaceship String===> |
ユーザー |
|
提出日時 | 2024-10-12 15:52:41 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 129 ms / 2,000 ms |
コード長 | 613 bytes |
コンパイル時間 | 341 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 120,960 KB |
最終ジャッジ日時 | 2024-10-16 17:54:55 |
合計ジャッジ時間 | 2,111 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 |
ソースコード
from sys import stdin def main(): s = stdin.readline().rstrip() last_str = [] tail = [] for c in s: last_str.append(c) if len(last_str) < 2 or len(tail) == 0: if c != '=': tail.append(c) continue if tail[-1] == '<' and last_str[-2] == '=' and last_str[-1] == '>': while last_str[-1] != '<': last_str.pop() last_str.pop() tail.pop() continue if c != '=': tail.append(c) print(len(last_str)) return if __name__ == "__main__": main()