結果

問題 No.1617 Palindrome Removal
ユーザー kimiyukikimiyuki
提出日時 2021-07-22 21:52:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 456 bytes
コンパイル時間 1,066 ms
コンパイル使用メモリ 87,132 KB
実行使用メモリ 79,208 KB
最終ジャッジ日時 2023-09-24 16:36:07
合計ジャッジ時間 5,021 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
79,044 KB
testcase_01 AC 103 ms
78,932 KB
testcase_02 AC 98 ms
79,140 KB
testcase_03 AC 101 ms
78,948 KB
testcase_04 AC 101 ms
79,024 KB
testcase_05 AC 93 ms
78,152 KB
testcase_06 AC 100 ms
78,036 KB
testcase_07 AC 93 ms
77,076 KB
testcase_08 AC 78 ms
70,916 KB
testcase_09 AC 78 ms
71,008 KB
testcase_10 AC 102 ms
78,900 KB
testcase_11 AC 99 ms
78,592 KB
testcase_12 AC 102 ms
79,208 KB
testcase_13 AC 104 ms
79,152 KB
testcase_14 AC 78 ms
70,884 KB
testcase_15 AC 80 ms
70,848 KB
testcase_16 AC 79 ms
70,952 KB
testcase_17 AC 79 ms
71,240 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 78 ms
71,048 KB
testcase_21 AC 81 ms
70,956 KB
testcase_22 AC 76 ms
71,048 KB
testcase_23 AC 74 ms
70,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/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
    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()
0