Problem:


Score : 200 points

Problem Statement

You are given a image with a height of H pixels and a width of W pixels.
Each pixel is represented by a lowercase English letter.
The pixel at the i-th row from the top and j-th column from the left is a_{ij}.

Put a box around this image and output the result. The box should consist of # and have a thickness of 1.

Constraints

1 ≤ H, W ≤ 100

a_{ij} is a lowercase English letter.

Input

Input is given from Standard Input in the following format:

H W
a_{11} ... a_{1W}
:
a_{H1} ... a_{HW}

Output

Print the image surrounded by a box that consists of # and has a thickness of 1.

Sample Input 1

2 3
abc
arc

Sample Output 1

#####
#abc#
#arc#
#####

Sample Input 2

1 1
z

Sample Output 2

###
#z#
###



Sample input:
2 3
abc
arc


Sample output:
#####
#abc#
#arc#
#####

Submission status: Wrong Answer

Solution code:
H, W = [int(x) for x in input().split()]
pic = [list(input()) for _ in range(H)]
ans = [['#' for i in range(W+2)] for j in range(H+2)]
for i in range(H):
  for j in range(W):
    ans[i+1][j+1] = pic[i][j]
for i in range(H+2):
  print(*ans[i])

Submission status: Wrong Answer

Solution code:
H, W = [int(x) for x in input().split()]
pic = [list(input()) for _ in range(H)]
ans = [['#' for i in range(W+2)] for j in range(H+2)]
for i in range(W):
  for j in range(H):
    ans[j+1][i+1] = pic[j][i]
for i in range(H+2):
  print(*ans[i])

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
s=[]
for i in range(a):
    s.append(input())
print("*"*(b+2))
for i in range(a):
    print("*",end="")
    print(s[i],end="")
    print("*")
print("*"*(b+2))

Submission status: Wrong Answer

Solution code:
x,y=input().split()
x=int(x)
y=int(y)
a=[input() for i in range(x)]
c=""
for i in range(y+2):
  c=c+"#"
print(c)
for i in range(x-1):
  print("#"+a[i]+"#")
print(c)

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())
data = []
for i in range(H):
  data.append(input().split())
print("#" * (W+2))
for i in range(H):
  print("#", end='')
  for j in range(W):
    print(j, end='')
  print("#")
print("#" * (W + 2))

Submission status: Wrong Answer

Solution code:
H,W = map(int, input().split())

for _ in range(H):
    Ans = ['#' + input() + '#']

print('#'*(W + 2))

for ans in Ans:
    print(ans)

print('#'*(W + 2))

Submission status: Wrong Answer

Solution code:
H,W = map(int,(input().split()))
a = [input() for _ in range(H)]

print('#'*(W+1))
for i in a:
    print('#'+str(i)+"#")
print('#'*(W+1))

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())
S = [0]*(H+2)
S[0] = '*'*(W+2)
S[H+1] = '*'*(W+2)
for h in range(1,H+1):
  S[h] = '*' + input() + '*'
print(*S,sep='\n')

Submission status: Wrong Answer

Solution code:
h, w = [int(x) for x in input().split()]
s = "*" * (w + 2)
print(s)
for _ in range(h):
    print("*" + input() + "*")
print(s)

Submission status: Wrong Answer

Solution code:
H,W = map(int,input().split())
A = [list(input()) for _ in range(H)]

ANS = []
for i in range(H+1):
  t = []
  for j in range(W+1):
    if i == 0 or j == 0 or i == H or j == W:
      t.append("#")
    else:
      t.append(A[i-1][j-1])
  ANS.append("".join(t))
  
print("\n".join(ANS))

Submission status: Wrong Answer

Solution code:
h, w = map(int, input().split())
a = [input() for _ in range(h)]

for _ in range(w+2):
  print('#', end='')
for i in a:
  print('#' + i + '#')
for _ in range(w+2):
  print('#', end='')

Submission status: Wrong Answer

Solution code:
H, W = input().split(' ')
H = int(H)
W = int(W)
print('*'*(W+2))
for i in range(H):
  s = input()
  print('*'+s+'*')
print('*'*(W+2))

Submission status: Wrong Answer

Solution code:
#49
H,W = map(int,input().split())

for i in range(W+2):
    print("#",end = "" )
for i in range(H):
    l = input()
    print("#",l,"#",sep = "")
for i in range(W+2):
    print("#",end = "")

Submission status: Wrong Answer

Solution code:
h,w=map(int,input().split())
a=[input() for _ in range(h)]
print('*'*len(max(a))+'**')
for s in a:
    print('*'+s+'*')
print('*'*len(max(a))+'**')

Submission status: Wrong Answer

Solution code:
h,w = [int(i) for i in input().split()]

print('#' * (w + 2))

for i in range(h):
  str = input()
  str = '*' + str + '*'
  print(str)

print('#' * (w + 2))

Submission status: Wrong Answer

Solution code:
h, w = map(int, input().split())
a = [list(input().split()) for _ in range(h)]
for i in a:
  i.insert(0, '#')
  i.append('#')
a.insert(0, ['#']*(w+2))
a.append(['#']*(w+2))
for i in a:
  print(*i)

Submission status: Wrong Answer

Solution code:
from collections import deque 
H,W = map(int,input().split())
st = [str(input()) for _ in range(H)]
print(st)
st = deque(st)
for i in range(H):
    st[i] = '#'+st[i]+'#'
st.appendleft('#'*(W+2))
st.append('#'*(W+2))

for i in range(H+2):
    print(st[i])

Submission status: Wrong Answer

Solution code:
H,W=map(int,input().split())

S=["#"*(W+2)]
for _ in range(H):
    S.append("#"+input()+"#")
S.append("#"*(W+2))

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())
A = ["#"+str(input())+"#" for _ in range(H)]
res = "#" * W
print(res)
for i in range(H):
    print(A[i])
print(res)

Submission status: Wrong Answer

Solution code:
H,W = map(int,(input().split()))
ans = [["*"]*(W+2) for _ in range(H+2)]
for i in range(H):
    a = list(input())
    ans[i+1][1:1+W] = a
for i in range(H+2):
    out = "".join(ans[i])
    print(out)

Submission status: Wrong Answer

Solution code:
h,w=map(int,input().split());print("#"*(w+2));
for i in range(h):print("#"+input()+"#");print("#"*(w+2))

Submission status: Wrong Answer

Solution code:
H,W = map(int,input().split())
A = [input().split() for i in range(H)]


X = "#"*W

#print(H,W,A)


for i in range(H):
	A[i][0] = "#" + A[i][0] +"#"

print(X)
for i in range(H):
	print(A[i][0])
print(X)

Submission status: Wrong Answer

Solution code:
h,w=map(int,input().split())
ans=[["#"]*(w+2)]
for i in range(h):
  temp=list(map(str,input()))
  temp.insert(0,"#")
  temp.append("#")
  ans.append(temp)
ans.append(["#"]*(w+2))
for i in range(h):
  print("".join(ans[i]))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
print("#"*m)
for i in range(n):
    print("#"+input()+"#")
print("#"*m)

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())
a = [str(input()) for i in range(H)]
sharp = str("#"*(W+2))

Lists = []
Lists.append([sharp])
for i in range(H):
    Lists.append(["#" + a[0] +"#"])

Lists.append([sharp])

for List in Lists:
    print(*List)

Submission status: Wrong Answer

Solution code:
def main():
    b, w = map(int, input().split())
    image = [list(input()) for _ in range(b)]
    print(image)
    image.insert(0, ["#"]*w)
    image.append(["#"]*w)
    for im in image:
        im.insert(0, "#")
        im.append("#")

    for im in image:
        print(*im, sep="")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
h,w = map(int,input().split())
a_list = [[s for s in input()] for _ in range(h)]
print(a_list)

return_list = []

for i,row in enumerate(a_list):
    if i == 0:
        return_list.append(['#' for _ in range(w+2)])
    row.insert(0,'#')
    row.append('#')
    return_list.append(row)
    if i == len(a_list)-1:
        return_list.append(['#' for _ in range(w+2)])

for elem in return_list:
    print(''.join(elem))

Submission status: Wrong Answer

Solution code:
h,w = map(int,input().split())

print('#'*w)
for i in range(h):
    s = input()
    print('#'+s+'#')
print('#'*w)

Submission status: Wrong Answer

Solution code:
h,w=map(int,input().split())
print('*'*(w+2))
for i in range(h):
  print('*' + input() + '*')
print('*'*(w+2))

Submission status: Wrong Answer

Solution code:
h,w=map(int,input().split())
a=[input() for i in range(h)]
print((w+1)*"#")
for i in range(h):
    print("#",a[i],"#",sep="")
print((w+1)*"#")

Submission status: Wrong Answer

Solution code:
H,W=map(int, input().split())
str_ = ""
for i in range(W):
  str_ = str_ + "#"
print(str_)
for i in range(H):
  S=str(input())
  print("#"+S+"#")
print(str_)

Submission status: Wrong Answer

Solution code:
#　なんで？？？？

H, W = map(int, input().split())
a = [list(input()) for _ in range(H)]
b = [[]*(W+2) for _ in range(H+2)]

b[0] = list('#'*(W+2))
b[H+1] = list('#'*(W+2))

for i in range(1,H+1):
    print(i)
    b[i] = list('#')
    for j in range(len(a[i-1])):
        b[i].append(a[i-1][j])
    b[i].append('#')

for i in range(H+2):
    for j in range(W+2):
        print(''.join(b[i][j]), end='')
    print()

Submission status: Wrong Answer

Solution code:
#　なんで？？？？

H, W = map(int, input().split())
a = [list(input()) for _ in range(H)]
b = [[]*(W+2) for _ in range(H+2)]

b[0] = list('#'*(W+2))
b[H+1] = list('#'*(W+2))

for i in range(1,H+1):
    print(i)
    b[i] = list('#')
    for j in range(len(a[i-1])):
        b[i].append(a[i-1][j])
    b[i].append('#')

for i in range(H+2):
    for j in range(W+2):
        print(''.join(b[i][j]), end='')
    print()

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())
a = [list(input()) for _ in range(H)]
b = [[]*(W+2) for _ in range(H+2)]

b[0] = list('#'*(W+2))
b[H+1] = list('#'*(W+2))

for i in range(1,H+1):
    print(i)
    b[i] = list('#')
    for j in range(len(a[i-1])):
        b[i].append(a[i-1][j])
    b[i].append('#')

for i in range(H+2):
    for j in range(W+2):
        print(''.join(b[i][j]), end='')

    if i == H+1:
        exit()
    print()

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())
a = [list(input()) for _ in range(H)]
b = [[]*(W+2) for _ in range(H+2)]

b[0] = list('#'*(W+2))
b[H+1] = list('#'*(W+2))

for i in range(1,H+1):
    print(i)
    b[i] = list('#')
    for j in range(len(a[i-1])):
        b[i].append(a[i-1][j])
    b[i].append('#')

for i in range(H+2):
    for j in range(W+2):
        print(''.join(b[i][j]), end='')

    print()

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())
a = [""] * H
for _a in a:
  _a = input()

print("#" * (W + 2))
for _a in a:
  print("#{}#".format(_a))
print("#" * (W + 2))

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())

print('#' * (W + 2))

for _ in range(W):
    try:
        print('#' + input() + '#')
    except EOFError:
        pass

print('#' * (W + 2))

Submission status: Wrong Answer

Solution code:
h,w=list(map(int,input().split()))
print('#'*(w+2))
a=[]
for i in range(h):
    a='#'
    a+=input()
    a+='#'
    print(a)
print('#'*w)

Submission status: Wrong Answer

Solution code:
H,W = map(int,input().split())
print('#'*W)
for i in range(H):
    a = input()
    print('#'+a+'#')
print('#'*W)

Submission status: Wrong Answer

Solution code:
#ABC062.B
H,W = map(int, input().split())
for i in range(H):
    a = input()
n = len(a)
print('#'*(n+2))
print('#'+a+'#')
print('#'*(n+2))

Submission status: Wrong Answer

Solution code:
h,w=map(int,input().split())
ans=[['']*(w+2)]*(h+2)
ans[0] = ['#' for i in range(w+2)]
ans[-1] = ['#' for i in range(w+2)]
for i in range(h):
  ans[i+1][1:w+1] = list(input())
  ans[i+1][0] = '#'
  ans[i+1][-1] = '#'
for i in range(h+2):
  print(*ans[i],sep='')

Submission status: Wrong Answer

Solution code:
# B
h, w = map(int, input().split())
a = []
for _ in range(h):
    a.append('#' + input() + '#')
    
from collections import deque
a = deque(a)
a.appendleft('#'*(w+1))
a.append('#'*(w+1))

for i in a:
    print(''.join(i))

Submission status: Wrong Answer

Solution code:
# B
h, w = map(int, input().split())
a = []
for _ in range(h):
    a.append('#' + input() + '#')
    
from collections import deque
a = deque(a)
a.appendleft('#'*w)
a.append('#'*w)

for i in a:
    print(''.join(i))

Submission status: Wrong Answer

Solution code:
H,W=map(int,input().split())
L=[]
for i in range (H):
	T=input()
	L.append(T)
A="#"*(H+2)
for i in range (H+2):
	if i==0 or i==H+1:
		print(A)
	else:
		print("#",end="")
		print(L[i-1],end="")
		print("#")

Submission status: Wrong Answer

Solution code:
h,w=map(int,input().split())
print("#"*w)
for _ in range(h):
  print("#"+input().strip()+"#")
print("#"*w)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

H,W = list(map(int, input().rstrip().split()))
a_list = [list(input().strip()) for _ in range(H)]
#-----

b_list=[ ["#" for c in range(W+2)] for r in range(H+2) ]

for i in range(H):
    for j in range(W):
        b_list[i+1][j+1] = a_list[i][j]

for li in b_list:
    print(*li)

Submission status: Wrong Answer

Solution code:
H, W = map(int,input().split())
S = [list(input()) for i in range(H)]

Ans = []
for i in range(H+2) :
    Ansi = ["#" for x in range(W+2)]
    if i != 0 and i != H+1 :
        for j in range(W) :
            print(i, j)
            Ansi[j+1] = S[i-1][j]
    Ans.append(Ansi)

for i in range(H+2) :
    print("".join(Ans[i]))

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())
A_list = []
for i in range(H):
    A = input()
    A_list.append(A)
str1 = ["*" for _ in range(W+2)]
str1 = "".join(str1)
for i in range(H+2):
    if i==0 or i==H+1:
        print(str1)
    else:
        print("*"+A_list[i-1]+"*")

Submission status: Wrong Answer

Solution code:
h,w = map(int, input().split())
for i in range(w):
  print('#', end='')
print()
for i in range(h):
  print('#', end='')
  print(input(), end='')
  print('#')
for i in range(w):
  print('#', end='')
print()

Submission status: Wrong Answer

Solution code:
h,w = map(int, input().split())
for i in range(w):
  print('#', end='')
print()
for i in range(h):
  print('#', end='')
  print(input(), end='')
  print('#')
for i in range(w):
  print('#', end='')

Submission status: Wrong Answer

Solution code:
h,w = map(int,input().split())
if h==1:
    a = ["#"*(h*2+1)]
else:
    a = ["#"*(h*2)]

for i in range(h):
    s = input()
    s = "#"+s+"#"
    a.append(s)
if h == 1:
    a.append("#"*(h*2+1))
else:
    a.append("#"*(h*2))
for i in range(len(a)):
    print(a[i])

Submission status: Wrong Answer

Solution code:
h,w=map(int,input().split())
print("*"*(w+2))
for i in range(h):
    a=input()
    print("*"+a+"*")
print("*"*(w+2))

Submission status: Wrong Answer

Solution code:
H,W = map(int, input().split())
a = [list(map(str, input().split())) for _ in range(H)]
print('#'*(len(a[0][0])+2))
for i in range(H):
    print(''.join(['#']+a[0]+['#']))
print('#'*(len(a[0][0])+2))

Submission status: Wrong Answer

Solution code:
h,w = map(int,input().split())
a = [input() for i in range(h)]
print(a)
print('#'*(w+2))
for i in a:
    print('#'+i+'#')
print('#'*(w+2))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
L = []
L.append("*"*(m+2))
for i in range(n):
    L.append("*"+input()+"*")
L.append("*"*(m+2))
for i in range(len(L)):
    print(L[i])

Submission status: Wrong Answer

Solution code:
H,W = map(int, input().split())

H_output = H+2
W_output = W+2

S = []
for _ in range(H):
    s = list(input())
    S.append(s)
count = 0
print(S)
for i in range(H_output):
    if i==0 or i==H+1:
        row = ["#"]*(W+2)
        print(*row,sep="")
        continue
    else:
        row_left = ["#"]*1
        row_right = ["#"]*1
        row = row_left + S[count] + row_right
        print(*row,sep="")
        count = count + 1

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())
mylist=[]
for i in range(H):
    var = input()
    mylist.append(var)
print("*"*(W+2))
for i in range(H):
    print ("*"+mylist[i]+"*")
print("*"*(W+2))

Submission status: Wrong Answer

Solution code:
h,w = map(int,input().split())
pic = [str(input()) for _ in range(h)]


for i in range(-1,h+1):
    if i == -1 or i == h:
        print(*['#'] * (h+2),sep='')
    else:
        print('#'+pic[i]+'#')

Submission status: Wrong Answer

Solution code:
H,W = map(int,input().split())
print("#"*W)
for i in range(H-2):
  print("#" + input() + "#")
print("#"*W)

Submission status: Wrong Answer

Solution code:

h,w = map(int,input().split())
s = [input() for i in range(h)]

print("#" * w * 2)
for i in range(h):
    print("#" + s[i] + "#")
print("#" * w * 2)

Submission status: Wrong Answer

Solution code:
h, w = map(int, input().split())
ls_a = [input() for _ in range(h)]

for i in range(h):
    ls_a[i] = "#" + ls_a[i] + "#"

top = "#" * len(ls_a[0])
bottom = "#" * len(ls_a[0])


print(top)
for j in range(h):
    print(ls_a[i])
print(bottom)

Submission status: Wrong Answer

Solution code:
#テストファイルで実行する時
import sys
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')

h,w = map(int,input().split())
s = [str('*'+input())+'*' for i in range(h)]

test = ''
for i in range(w+2):
	test = test + '*' 

#リストsの頭にtestを追加
s.insert( 0,test)

#リストsの最後にtestを追加
s.insert(len(s),test)

for i in range(h+2):
	print(''.join(s[i]))

Submission status: Wrong Answer

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

h,w = inpl()
s = [input() for i in range(h)]
res = [''] * (h+2)
for i in range(h+2):
    if i == 0 or i == h+1:
        res[i] = '#' * (w+2)
        continue
    res[i] = '#' + s[i-2] + '#'
for i in res:
    print(i)

Submission status: Wrong Answer

Solution code:
H,W = map(int,input().split())
List = []
for _ in range(H):
  S = input()
  List.append(S)
print('*'*(W+2))
for i in range(H):
  print('*'.strip(),end='')
  print(List[i].strip(),end='')
  print('*')
print('*'*(W+2))

Submission status: Wrong Answer

Solution code:
h,w=map(int,input().split())
a=[input() for i in range(h)]
print(a)
print("#"*(w+2))
for i in range(h):
    print("#"+a[i]+"#")
print("#"*(w+2))

Submission status: Wrong Answer

Solution code:
import sys
s = sys.stdin.readlines()

H, W = map(int, s[0].split())
a0 = '#' * (W + 2)
print(a0)
for i in range(H):
    print('#' + s[i + 1] + '#')
print(a0)

Submission status: Wrong Answer

Solution code:
h,w = map(int, input().split())
n = list(input() for _ in range(h))

tb = '#'*(w+2)

for i in range(h):
    n[i] = '#'+n[i]+'#'
else:
    n.insert(0, tb)
    n.append(tb)

print(n[g] for g in range(h+2))

Submission status: Wrong Answer

Solution code:
h,w = map(int,input().split())
for i in range(w):
    print("#",end="")
print("")
for i in range(h):
    a = input()
    print("#" + a + "#")

for i in range(w):    
    print("#",end="")

Submission status: Wrong Answer

Solution code:
h,w = map(int,input().split())
for i in range(w):
    print("#",end="")
print("")
for i in range(h):
    a = input()
    print("#" + a + "#")

for i in range(w):    
    print("#")

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())


pic = ["#"]*(W+2)
pic_list = []
pic_list.append(pic)

for i in range(H):
    pic = "#"+input()+"#"
    pic_list.append(pic)

pic = ["#"]*(W+2)
pic_list.append(pic)

for i in pic_list:
    print(*i)

Submission status: Wrong Answer

Solution code:
h,w = map(int,input().split())
L = []
L.append(["#"]*(w+2))
for i in range(h):
    l=["#"]
    l.append(input())
    l.append("#")
    print(l)
    L.append(l)
L.append(["#"]*(w+2))
for i in range(h+2):
    print("".join(L[i]))

Submission status: Wrong Answer

Solution code:
h, w = map(int, input().split())
S = [input() for i in range(h)]
print(S)
print("#"*(w+2))
for s in S:
  print("#"+s+"#")
print("#"*(w+2))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    H,W = inputMap()
    a = []
    for i in range(H):
        tmp = input()
        tmp = "*" + tmp + "*"
        a.append(tmp)
        
    tmp = ""
    for i in range(W+2):
        tmp += "*"
    
    print(tmp)
    for i in a:
        print(i)
    print(tmp)
    
    
class UnionFind(object):
	def __init__(self, n=1):
		self.par = [i for i in range(n)]
		self.rank = [0 for _ in range(n)]
		self.size = [1 for _ in range(n)]
		
	# x が属するグループを探索
	def find(self, x):
		if self.par[x] == x:
			return x
		else:
			self.par[x] = self.find(self.par[x])
			return self.par[x]
		
	# x と y のグループを結合
	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x != y:
			# メンバ数の更新
			sum = self.size[x] + self.size[y]
			self.size[x] = sum
			self.size[y] = sum
			# 短いリストを長いリストのルートに繋ぎ直す
			if self.rank[x] < self.rank[y]:
				x, y = y, x
			if self.rank[x] == self.rank[y]:
				self.rank[x] += 1
			self.par[y] = x
	
	# x と y が同じグループがどうか
	def is_same(self, x, y):
		return self.find(x) == self.find(y)
		
	# x が属するグループのメンバ数を返却
	def getSize(self, x):
		par_x = self.find(x)
		return self.size[par_x]
	
if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
h,w = map(int,input().split())
l=[str(input()) for i in range(h)]
p="*"
print(p*(w+2))
for j in l:
    print(p+j+p)
print(p*(w+2))

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline

h,w = list(map(int, input().split()))
a = [["#"]*(w+2) for i in range(h+2)]

for i in range(h):
    s = input().strip()
    for j in range(w):
        a[i+1][j+1] = s[j]

for i in a:
    print(*i)

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())
pics = [input() for i in range(H)]

for i in range(H+2):
    if i == 0:
        print("#"*(W+2))
    if i == H+1:
        print("#"*(W+2))
    else:
        print("#"+pics[i-1]+"#")

Submission status: Wrong Answer

Solution code:
def return_same_order_str(char, n): #(char, pieces) return str
    string = ""
    for i in range(n):
        string += char

    return string

h, w = map(int, input().split())

input_pic = []

for i in range(h):
    input_pic.append(str(input()))

for y in range(h+2):
    if y == 0 or y == h+1:
        print(return_same_order_str("#", w+2))
    else:
        print("#"+ input_pic[-1] + "#")

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())
edge = [['#'] * (W+2)]
output = edge + [['#'] + list(input()) + ['#'] for __ in range(H)] + edge
print(output)
for row in output:
  row_str = ''.join(row)
  print(row_str)

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())
edge = ['#' for _ in range(W+2)]
output = edge + [['#'] + list(input()) + ['#'] for __ in range(H)] + edge
for row in output:
  row_str = ''.join(row)
  print(row_str)

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())
edge = ['#' for _ in range(W)]
output = edge + [list(input()) for __ in range(H)] + edge
for row in output:
  row_str = ''.join(row)
  print(row_str)

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())

S = ""
for i in range(W):
  S += "#"

A = []
A.append(S) 

for i in range(H):
  A.append("#"+input()+"#")
A.append(S)

for i in range(H+2):
  print(A[i])

Submission status: Wrong Answer

Solution code:
H,W = list(map(int,input().split()))
a = [input() for i in range(H)]

for i in range(H+2):
  if i==0 or i==H+1:
    "#"*(W+2)
  else:
    print("#"+a[i-1]+"#")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b, c = LI()
    if a <= c <= b:
        print("Yes")
        return
    print("No")
    return

#B
def B():
    h, w = LI()
    print("#" * (w + 2))
    for _ in range(h):
        a = []
        for s in S():
            a.append(s)
        a.append("#")
        print("".join(a))
    print("#" * (w + 2))
    return

#C
def C():
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    B()

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
c = ["*"*(b+2)]
for i in range(a):
    c.append("*" + input() + "*")
c.append("*"*(b+2))
for i in range(a+2):
    print("".join(c[i]))

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
c = ["#" + input() + "#" for _ in range(a)]
c.insert(0, "#" * (b+1))
c.append("#" * (b+1))
for i in range(len(c)):
    print(c[i])

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())
S = []
for _ in range(H):
    S.append(input())

print("*" * (W+2))
for s in S:
    print("*" + s + "*")
print("*" * (W+2))

Submission status: Wrong Answer

Solution code:
h,w = map(int,input().split())
aa = [input() for _ in range(h)]

print(aa)

for i in range(h+2):
    if i == 0 or i == h+1:
        print('#'*(w+2))
    else:
        print('#'+aa[i-1]+'#')

Submission status: Wrong Answer

Solution code:
h, w = [int(i) for i in input().split()]
lst = []
for i in range(h):
    lst.append(input())

print(lst)
for i in range(h+2):
    if i == 0:
        print("#" * (w + 2))
for i in lst:
    ans = "#" + i + "#"
    print(ans)

print("#" * (w + 2))

Submission status: Wrong Answer

Solution code:
h, w = map(int, input().split())
hw = '#'*(w+2)
a = []
for i in range(h):
    a.append(input())
print(hw)
for i in range(h):
    print('#'+a[0]+'#')
print(hw)

Submission status: Wrong Answer

Solution code:
H,W=map(int,input().split())
MAP=[input() for i in range(H)]

ANS=[["#"]*(W+2) for i in range(H+2)]

for i in range(H):
    for j in range(W):
        ANS[i+1][j+1]=MAP[i][j]

for i in range(H+2):
    print(*ANS[i])

Submission status: Wrong Answer

Solution code:
h, w = map(int, input().split())
a = []
for i in range(h):
    a.append(input())
print("#"*(w+2))
for j in range(h):
    print("#" + a[0] + "#")
print("#"*(w+2))

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())

for w in range(W+1):
  print("#", end="")
print("")
for h in range(H):
  row = str(input())
  print("#" + row + "#")
for w in range(W+1):
  print("#", end="")

Submission status: Wrong Answer

Solution code:
h, w = map(int, input().split())

a = [input() for _ in range(h)]

print("#" * (w + 1))
for i in a:
  print("#" + i + "#")
print("#" * (w + 1))

Submission status: Wrong Answer

Solution code:

def read_input():
    h, w = map(int, input().split())

    slist = []
    for i in range(h):
        slist.append(input().strip())

    return h, w, slist

def submit():
    h, w, slist = read_input()

    print('#'*(w + 2))
    for s in slist:
        print('#' + s + '#')
    print('#'*(w + 2))

if __name__ == '__main__':
    submit

Submission status: Wrong Answer

Solution code:
H, W = map(int,input().split())
A = [input() for _ in range(H)]

for i in range(H+1):
    if i in (0, H):
        print('#' * (W+2))
    else:
        print('#' + A[i] + '#')

Submission status: Wrong Answer

Solution code:
H, W = map(int,input().split())
A = [input() for _ in range(H)]

for i in range(H+1):
    if i in (0, H):
        print('#' * W)
    else:
        print('#' + A[i] + '#')

Submission status: Wrong Answer

Solution code:
H, W = map(int,input().split())
A = [list(input()) for _ in range(H)]

for i in range(H):
    if i in (0, H):
        print('#' * W)
    else:
        A[i][0] = '#'
        A[i][-1] = '#'
        print("".join(A[i]))

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())
a = [""] * H
for i in range(H):
    a[i] = input()

print("#" * (W * 2))
for i in range(H):
    print('#', a[i], "#", sep="")
print("#" * (W * 2))

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())
a = [input() for i in range(H)]

print('*' * (W + 2))
for ai in a:
    print('*{}*'.format(ai))
print('*' * (W + 2))

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())
a = [input() for i in range(H)]

print('*' * W)
for ai in a:
    print('*{}*'.format(ai))
print('*' * W)

Submission status: Wrong Answer

Solution code:
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n, m = f()
    s = [ input() for i in range(n)]
    print(s)


    for i in range(n+2):
        if i == 0 or i == n+1:
            for j in range(m+2):
                print('#', end = '')
            print()
        else:
            print('#',end = '')
            print(s[i-1], end = '')
            print('#')


solve()

Submission status: Wrong Answer

Solution code:

h,w = map(int,input().split())

ans = []
ans.append("*"*(w+2))
for i in range(h):
  s = input()
  tmp = "*"
  tmp += s
  tmp += "*"
  ans.append(tmp)
  

ans.append("*"*(w+2))
for i in ans:
  print(i)

Submission status: Wrong Answer

Solution code:
h, w = map(int, input().split())
a = [None for i in range(h + 2)]
a[0] = ['#' for i in range(w + 2)]
a[-1] = ['#' for i in range(w + 2)]
for i in range(1, h + 1):
    a[i] = ['#'] + list(input()) + ['#']

for i in range(h + 2):
    print(*a[i])

Submission status: Wrong Answer

Solution code:
t,*s=open(0);t=['#'*(int(t.split()[1])+2)];a=t+['#'+t+'#'for t in s]+t;print(*a)

Submission status: Wrong Answer

Solution code:
H,W=map(int,input().split())
print('#'*W)
for i in range(H):
	t=input()
	print('#'+t+'#')
print('#'*W)

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())
a = input()
print('#' * (len(a) + 2), '#' + a + '#', '#' * (len(a)+2), sep='\n')

Submission status: Wrong Answer

Solution code:
def picture_frame(H: int, W: int, A: list)->list:
    return ['#' * (W+2)] + ['#' + s + '#' for s in A] + ['#' * (W+2)]


if __name__ == "__main__":
    H = 0
    H, W = map(int, input().split())
    A = [input() for _ in range(H)]

Submission status: Wrong Answer

Solution code:
H, W = list(map(int, input().split()))

for i in range(H + 2):
    if i == 0 or i == (H + 1):
        print("*" * (W + 2))
    else:
        print("*{}*".format("".join(list(map(str, input())))))

Submission status: Wrong Answer

Solution code:
H, W = list(map(int, input().split()))

result = [["*"] * W] * (H + 2)
for i in range(H):
    a = list(map(str, input()))
    result[i + 1] = a

for i in range(len(result)):
    print("".join(result[i]))

Submission status: Wrong Answer

Solution code:
h,w = map(int, input().split())
print("#"*w)
for i in range(h):
  print("#"+input()+"#")
print("#"*w)

Submission status: Wrong Answer

Solution code:
h,w=map(int,input().split())
a=['#']*(h+2)+['#'+input()+'#' for _ in range(h)]+['#']
for x in a:
  print(x)