結果
問題 | No.1617 Palindrome Removal |
ユーザー |
|
提出日時 | 2021-07-22 22:29:22 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 68 ms / 2,000 ms |
コード長 | 494 bytes |
コンパイル時間 | 158 ms |
コンパイル使用メモリ | 82,520 KB |
実行使用メモリ | 79,248 KB |
最終ジャッジ日時 | 2024-07-17 18:37:00 |
合計ジャッジ時間 | 2,477 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#!/usr/bin/env python3 # from typing import * def solve(s: str) -> int: if s != ''.join(reversed(s)): return len(s) if s == s[0] * len(s): if len(s) % 2 == 0: return 0 else: return -1 if len(s) == 3: return -1 return len(s) - 2 # generated by oj-template v4.8.0 (https://github.com/online-judge-tools/template-generator) def main(): S = input() a = solve(S) print(a) if __name__ == '__main__': main()