結果
| 問題 |
No.1617 Palindrome Removal
|
| コンテスト | |
| ユーザー |
tamato
|
| 提出日時 | 2021-07-22 21:25:29 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 110 ms / 2,000 ms |
| コード長 | 577 bytes |
| コンパイル時間 | 195 ms |
| コンパイル使用メモリ | 82,584 KB |
| 実行使用メモリ | 96,484 KB |
| 最終ジャッジ日時 | 2024-07-17 16:16:41 |
| 合計ジャッジ時間 | 2,929 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
mod = 1000000007
eps = 10**-9
def main():
import sys
input = sys.stdin.readline
S = input().rstrip('\n')
if len(set(S)) == 1:
if len(S) & 1:
print(-1)
else:
print(0)
exit()
if len(S) & 1:
if S != S[::-1]:
print(len(S))
else:
if len(S) == 3:
print(-1)
else:
print(len(S) - 2)
else:
if S == S[::-1]:
print(len(S) - 2)
else:
print(len(S))
if __name__ == '__main__':
main()
tamato