結果

問題 No.1617 Palindrome Removal
ユーザー tassei903tassei903
提出日時 2021-07-22 22:11:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 252 bytes
コンパイル時間 407 ms
コンパイル使用メモリ 86,788 KB
実行使用メモリ 88,328 KB
最終ジャッジ日時 2023-09-24 17:14:22
合計ジャッジ時間 3,526 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 98 ms
88,248 KB
testcase_02 AC 98 ms
87,516 KB
testcase_03 AC 96 ms
87,624 KB
testcase_04 AC 98 ms
88,200 KB
testcase_05 AC 94 ms
85,656 KB
testcase_06 AC 99 ms
88,228 KB
testcase_07 AC 89 ms
83,164 KB
testcase_08 AC 68 ms
71,400 KB
testcase_09 AC 68 ms
71,440 KB
testcase_10 AC 97 ms
87,124 KB
testcase_11 AC 97 ms
85,752 KB
testcase_12 AC 101 ms
88,264 KB
testcase_13 AC 100 ms
88,328 KB
testcase_14 AC 69 ms
71,324 KB
testcase_15 AC 70 ms
71,324 KB
testcase_16 AC 70 ms
71,140 KB
testcase_17 AC 70 ms
71,140 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 69 ms
71,312 KB
testcase_21 AC 73 ms
71,144 KB
testcase_22 WA -
testcase_23 AC 69 ms
71,140 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:
        print(0)
    elif a==b:
        print(n-2)
    else:
        print(n)

        
0