結果

問題 No.1617 Palindrome Removal
ユーザー rlangevin
提出日時 2023-01-09 15:03:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 268 bytes
コンパイル時間 575 ms
コンパイル使用メモリ 82,408 KB
実行使用メモリ 106,544 KB
最終ジャッジ日時 2024-12-17 18:39:22
合計ジャッジ時間 3,542 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 18 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

S = list(input())
N = len(S)
left, right = 0, N - 1
while left < right:
    if S[left] != S[right]:
        print(N)
        exit()
    left += 1
    right -= 1
if len(set(S)) == 1:
    if len(S) % 2:
        print(-1)
    else:
        print(0)
else:
    print(N - 2)
0