結果

問題 No.2234 palindromer
ユーザー shobonvip
提出日時 2023-03-03 21:30:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 348 bytes
コンパイル時間 424 ms
コンパイル使用メモリ 81,536 KB
実行使用メモリ 52,352 KB
最終ジャッジ日時 2024-09-17 22:22:18
合計ジャッジ時間 1,693 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

a = input()
n = len(a)

t = 10 ** 9
ans = ""

for i in range(n+1):
	v = a[:i]
	w = v[::] + v[::-1]
	if len(w) < n: continue
	if w[:n] == a:
		if len(w) < t:
			t = len(w)
			ans = w
	
for i in range(1, n+1):
	v = a[:i]
	w = v[:-1] + v[-1] + v[:-1][::-1]
	if len(w) < n: continue
	if w[:n] == a:
		if len(w) < t:
			t = len(w)
			ans = w

print(ans)
0