結果

問題 No.238 Mr. K's Another Gift
ユーザー HIROPON87069639
提出日時 2016-02-22 21:41:52
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 890 bytes
コンパイル時間 466 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 7,168 KB
最終ジャッジ日時 2024-09-22 13:05:59
合計ジャッジ時間 3,774 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-

def kai(S):
    cnts = 0
    cntf = len(S)-1
    while cnts <= cntf :
        if S[cnts] != S[cntf]:
            return 0
        cnts += 1
        cntf -= 1
    return 1



S = list(raw_input())
if len(S) == 1:
    print "".join(S*2)
if kai(S):
    n = len(S) / 2
    S.insert(n ,S[n])
    print "".join(S)

cnts = 0
cntf = len(S)-1
while cnts <= cntf :
    if S[cnts] != S[cntf]:
        if S[cnts +1] == S[cntf]:
            S.insert(cntf+1, S[cnts])
            if kai(S):
                print "".join(S)
                exit()
            else:
                print "NA"
                exit()
            exit()
        elif S[cnts] == S[cntf-1]:
            S.insert(cnts, S[cntf])
            if kai(S):
                print "".join(S)
                exit()
            else:
                print "NA"
                exit()
    cnts += 1
    cntf -= 1
0