結果

問題 No.238 Mr. K's Another Gift
ユーザー lloyz
提出日時 2023-11-17 07:09:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 502 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 60,800 KB
最終ジャッジ日時 2024-09-26 05:17:02
合計ジャッジ時間 5,209 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()
n = len(s)

if s == s[::-1]:
    ans = s[:n // 2] + s[n // 2] + s[n // 2:]
    print(ans)
    exit()
for i in range(n):
    if s[i] != s[n - i - 1]:
        res = s[:i] + s[n - i - 1] + s[i:]
        if res == res[::-1]:
            print(res)
            exit()
        res = s[:n - i] + s[i] + s[n - i:]
        if res == res[::-1]:
            print(res)
            exit()
        print("NA")
        exit()
0