結果

問題 No.1617 Palindrome Removal
ユーザー tassei903tassei903
提出日時 2021-07-22 22:13:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 311 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 88,284 KB
最終ジャッジ日時 2023-09-24 17:18:53
合計ジャッジ時間 4,217 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
87,480 KB
testcase_01 AC 106 ms
87,952 KB
testcase_02 AC 104 ms
87,552 KB
testcase_03 AC 105 ms
87,460 KB
testcase_04 AC 107 ms
88,168 KB
testcase_05 AC 103 ms
85,520 KB
testcase_06 AC 107 ms
88,032 KB
testcase_07 AC 98 ms
83,184 KB
testcase_08 AC 75 ms
70,992 KB
testcase_09 AC 76 ms
71,184 KB
testcase_10 AC 107 ms
87,468 KB
testcase_11 AC 103 ms
85,716 KB
testcase_12 AC 107 ms
88,284 KB
testcase_13 AC 109 ms
88,188 KB
testcase_14 AC 75 ms
71,208 KB
testcase_15 AC 74 ms
71,472 KB
testcase_16 AC 77 ms
71,368 KB
testcase_17 AC 74 ms
70,984 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 75 ms
71,212 KB
testcase_21 AC 76 ms
71,188 KB
testcase_22 AC 76 ms
71,144 KB
testcase_23 AC 75 ms
71,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()
if len(s)==1:
    print(-1)
else:
    n = len(s)
    a = s[:(n+1)//2]
    b = s[::-1][:(n+1)//2]
    if sum([s[0]==s[i]for i in range(n)])==n and a==b:
        if n%2==0:
            print(0)
        else:
            print(-1)
    elif a==b:
        print(n-2)
    else:
        print(n)

        
0