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:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)

H, W = map(int, input().split())

grid = [["#"]*(W+2) for _ in range(H+2)]

for i in range(1, H+1):
    for j, c in enumerate(input()):
        grid[i][j+1] = c

for i in grid:
    print(i)

Submission status: Wrong Answer

Solution code:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)

H, W = map(int, input().split())

grid = [["#"]*(W+2) for _ in range(H+2)]

for i in range(1, H+1):
    for j, c in enumerate(input()):
        grid[i][j+1] = c

for i in grid:
    print(" ".join(i))

Submission status: Wrong Answer

Solution code:
h, m = map(int, input().split())
C = [input() for i in range(h)]

hana = '*' * (m + 2)
print(hana)
for i in range(h):
    print('*' + C[i] + '*')
print(hana)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
A = []
for i in range(N):
    A.append(str(input()))
print("#"*(M+2))
print("#"+A[i]*"#" for i in range(N))
print("#"*(M+2))

Submission status: Wrong Answer

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


def main():
    """Function."""
    h, w = map(int, input().split())

    sharp = ""
    for _ in range(w+2):
        sharp += "#"

    for _ in range(h):
        dum = "#"
        a = str(input())
        dum += a
        dum += "#"
        print(dum)

    print(sharp)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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


def main():
    """Function."""
    h, w = map(int, input().split())

    sharp = ""
    for _ in range(w+2):
        sharp += "#"

    for _ in range(h):
        dum = "#"
        a = str(input())
        dum += a
        dum += "#"

    print(sharp)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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


def main():
    """Function."""
    h, w = map(int, input().split())

    sharp = ""
    for _ in range(w+2):
        sharp += "#"
    print(sharp)

    for _ in range(h):
        dum = "#"
        dum += str(input())
        dum = "#"
        print(dum)

    print(sharp)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

result = []
for a in A:
  result.append('*' + a +'*')
waku = '*' * (W+2)
result.insert(0,waku)
result.insert(len(A)+1,waku)
for r in result:
  print(r)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

h,w=map(int,input().split())
ans=h*w
if h*w%3==0:
    print(0)
else:
    for x,y in ((h,w),(w,h)):
        x1=x//3
        x2=(x+2)//3
        y1=y//2
        y2=(y+1)//2
        ans=min(ans,abs(y*x2-y*x1))
        ans=min(ans,abs(y*x2-(x-x2)*(y-y2)))
        ans=min(ans,abs(y*x1-(x-x1)*(y-y2)))
print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin


def main():
    h, w = map(int, input().split())
    a = [next_str() for _ in range(h)]

    for i in range(h + 2):
        print("#", end="")
        if not 0 < i <= h:
            print("#" * w, end="")
        else:
            print([i - 1], end="")
        print("#")


def next_int() -> int:
    return int(next_str())


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

a = []

for i in range(h):
    a.append(input())

print(a)

ans = []

for i in range(h + 2):
    if i == 0 or i == h + 1:
        s = ""
        for j in range(w + 2):
            s = s + "#"

        ans.append(s)

    else:
        s = "#" + a[i - 1] + "#"
        ans.append(s)

#print(ans)

print('\n'.join(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
H,W=map(int,input().split())
S=[input() for i in  range(H)]
D=['']*(H+2)
D[0]='#'*(W+2)
D[H+1]='#'*(W+2)
for i in range(1,H+1):
    D[i]='#'+S[i-2]+'#'
for i in range(H+2):
    print(D[i])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
h,w = map(int,input().split())
for i in range(h+2):
    if i == 0 or i == h+1:
        print("#"*w)
    else:
        temp = input()
        print("#"+temp+"#")

Submission status: Wrong Answer

Solution code:
h,w=map(int, input().split())
ar=[input() for _ in range(0,h)]
print("*"*w+"**")
for _ in ar:
    print("*"+_+"*")
print("*"*w+"**")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())

S=[]

for i in range(n):
    tmp=input()
    S.append(tmp)

s=[]

for i in range(m+2):
    s.append("#")

print(''.join(s))

for i in range(n):
    tmp=["#", S[0], "#"]
    print(''.join(tmp))

print(''.join(s))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

option = ["#"]*(W+2)
input_list.insert(0, option)
input_list.append(option)

for i in range(1, H+1):
    input_list[i].insert(0, "#")
    input_list[i].append("#")

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

Submission status: Wrong Answer

Solution code:
h,w=map(int,input().split());print("#"*w);print("\n".join(["#"+input()+"#"for _ in [0]*h]));print("#"*w)

Submission status: Wrong Answer

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

solve()

Submission status: Wrong Answer

Solution code:

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

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

for _ in range(h):
    print("*" + input() + "*")


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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
h,w=map(int,input().split())
moji=[]
for i in range(h):
    moji.append(input())
print('#'*w)
for s in moji:
    print('#'+s+'#')
print('#'*w)

Submission status: Wrong Answer

Solution code:
def twoDimArraywithwall(row,column,n,wallchar): return [[n if j!=0 and j!=(column+1) else wallchar for j in range(column+2)] if i!=0 and i!=(row+1) else [wallchar]*(column+2) for i in range(row+2)]
def maketwodimarraywithwall(matrix,wallchar):
    rownum=len(matrix)
    colnum=len(matrix[0])
    ret=twoDimArraywithwall(rownum,colnum,None,wallchar)
    for i in range(rownum):
        for j in range(colnum):
            ret[i+1][j+1]=matrix[i][j]
    return ret


H, W = map(int, input().split())
table = []
for h in range(H):
    table.append(list(input())) 
print(maketwodimarraywithwall(table,"#"))

Submission status: Wrong Answer

Solution code:
size=[int(i) for i in input().split()]
image=[[str(input())] for i in range(size[0])]

print(image)
print("#"*(size[1]+2))
for i in image:
    print(''.join(["#"]+i+["#"]))
print("#"*(size[1]+2))

Submission status: Wrong Answer

Solution code:
import sys

H,W = raw_input().split()
a =[]
for line in range(int(H)):
    a.append(raw_input())

print a

for i in range(0,int(W)+2):
    sys.stdout.write("#")
print

for i in range(0,int(H)):
    sys.stdout.write("#")
    for j in range(0,int(W)):
        sys.stdout.write(a[i][j])
    sys.stdout.write("#")
    print

for i in range(0,int(W)+2):
    sys.stdout.write("#")
print

Submission status: Wrong Answer

Solution code:
lines = raw_input().splitlines()
hw = lines.pop(0).split(" ")
w = int(hw[1])
print("#"*(w+2))
for line in lines:
    print ("#" + line + "#")

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

Submission status: Wrong Answer

Solution code:

x = list(map(int, input().split()))
a=[input() for i in range(x[0])]

for i in range(x[1]):
    print('#',end="")
print('')
for i in a:
    print('#{0}#'.format(i))
for i in range(x[1]):
    print('#',end="")

Submission status: Wrong Answer

Solution code:

x = list(map(int, input().split()))
a=[input() for i in range(x[0])]

for i in range(x[1]):
    print('#',end="")
print('')
for i in a:
    print('#{0}#'.format(i))
for i in range(x[1]):
    print('#',end="")
print('')

Submission status: Wrong Answer

Solution code:
# input()
y, x = map(int, input().split(" "))

h = []
for v in range(0, x+2):
    h.append("#")
    
print(h)
for v in range(0, y):
    print("#" + input() + "#")

print(h)

Submission status: Wrong Answer

Solution code:
def solve():
    H,W=map(int,input().split())
    for i in range(W+2):
        print("#",end='')
    print()
    for i in range(H):
        print("#")
        s=input()
        print(s)
        print("#")
    for i in range(W+2):
        print("#",end='')
    print()


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
ipt = input().split()
h, w = [int(n) for n in ipt[:2]]
img = [str(n) for n in ipt[2:]]


print('#'*(w + 2))
for i in range(h):
    ans='#'
    for j in img[w * i: w * (i + 1)]:
        ans+=j
    ans+='#'
    print(ans)
print('#'*(w + 2))

Submission status: Wrong Answer

Solution code:
ipt = input().split()
h, w = [int(n) for n in ipt[:2]]
img = [str(n) for n in ipt[2:]]
ans=''

for i in range(w + 2):
    ans+='#'
ans+="\n"
for i in range(h):
    ans+='#'
    for j in img[w * i: w * (i + 1)]:
        ans+=j
    ans+='#'
    ans+= "\n"
for i in range(w+2):
    ans+='#'
print(ans)

Submission status: Wrong Answer

Solution code:
a = input().split(" ")

tmp_out=[[""] for i in range(int(a[0])+2)]

for j in range(int(a[1])+2):
    tmp_out[0]=["".join(tmp_out[0]+["#"])]

for i in range(1, int(a[0])+1):
    tmp=input().split(" ")
    tmp_out[i]=["".join(["#"]+tmp+["#"])]

tmp_out[int(a[0])+1]=tmp_out[0]

for i in range(int(a[0])+2):
    print(tmp_out[i])

Submission status: Wrong Answer

Solution code:
h,w=map(int,input().split())
print('#'*-~w)
for _ in[0]*h:print('#'+input()+'#')
print('#'*-~w)

Submission status: Wrong Answer

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

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

for i in range(H):
        print("#", end = "")
        print(str[i], end = "")
        print("#")

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

Submission status: Wrong Answer

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

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

for i in range(H):
        print("#", end = "")
        print(str[i], end = "")
        print("#")

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

Submission status: Wrong Answer

Solution code:
inputnums = input().split()                                                                   
x = int(inputnums[0])
y = int(inputnums[1])
inputstr=[]
for i in range(x):
        inputstr.append(input())
pixel=[]
w=y+3
pixel.append("#"*w)
for i in range(x):
        pixel.append("#"+inputstr[i]+"#")


pixel.append("#"*len(pixel[-1]))
output=""
for i in range(len(pixel)):
    output+=pixel[i]+"\n"

print(output)

Submission status: Wrong Answer

Solution code:
inputnums = input().split()                                                                   
x = int(inputnums[0])
y = int(inputnums[1])
inputstr=[]
for i in range(x):
        inputstr.append(input())
pixel=[]
w=y+3
pixel.append("#"*w)
for i in range(x):
        pixel.append("#"+inputstr[i]+"#")


pixel.append("#"*len(pixel[-1]))

for i in range(len(pixel)):
    print (pixel[i])

Submission status: Wrong Answer

Solution code:
x=[int(i) for i in input (). split ()]
g=[0,0]
for i in range(len(x)):
    if x[i]==2:
        g[i]=2
    elif x[i]==4 or x[i]==6 or x[i]==9 or x[i]==11:
        g[i]=1
if g[0]==g[1]:
    print ("Yes")
else:
    print ("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
data = input().split()
H = int(data[0])
W = int(data[1])

str = []
for i in range(H):
	data = input()
	str.append(data[:W])

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

Submission status: Wrong Answer

Solution code:
data = input().split()
H = int(data[0])
W = int(data[1])

str = []
for i in range(H):
	data = input()
	str.append(data[:W])

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

Submission status: Wrong Answer

Solution code:
import sys

if __name__ == '__main__':
    count = 0
    for line in sys.stdin:
        D = []
        if count == 0:
            line = line.rstrip("\n").split(" ")
            H = int(line[0])
            W = int(line[1])
            count+=1

        else:
            D.append(line.rstrip("\n"))

    print("".join(["#"]*(W+2)))
    for i in range(len(D)):
        print("#"+D[i]+"#")
    print("".join(["#"]*(W+2)))

Submission status: Wrong Answer

Solution code:
data = input().split()
H = int(data[0])
W = int(data[1])

str = []
for i in range(H):
	data  = input().split()
	str.append(data[:W])

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

Submission status: Wrong Answer

Solution code:
import sys

if __name__ == '__main__':
    count = 0
    for line in sys.stdin:
        D = []
        if count == 0:
            line = line.rstrip("\n").split(" ")
            H = int(line[0])
            W = int(line[1])
            count+=1

        else:
            D.append(line.rstrip("\n"))

    print("".join(["#"]*(W+1)))
    for i in range(len(D)):
        print("#"+D[i]+"#")
    print("".join(["#"]*(W+1)))

Submission status: Wrong Answer

Solution code:

mat_small = []
xy = input().split(' ')
for i in range(int(xy[0])):
    mat_small.append(input())

big  = [(int(xy[0])+ 2)* '#'  for a in range(int(xy[0])+ 2) ]

for s in range(1, (int(xy[0])+ 1)):
    big[s] = '#' + mat_small[s-1] + '#'
print( big)

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
a = []
for i in range(N):
    a.append(input())
print(a)

print("#"*(M+2))
for i,b in enumerate(a):
  print("#"+a[i]+"#")
print("#"*(M+2))

Submission status: Wrong Answer

Solution code:
# coding: utf-8

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

pic = [["#" for _j in xrange(w+2)] for _i in xrange(h+2)]

for i in xrange(h):
    aij = raw_input()

    for j in xrange(len(aij)):
        pic[i+1][j+1] = aij[j]

for p in pic:
    print p

Submission status: Wrong Answer

Solution code:
H,W = map(int,raw_input().split(' '))
print "#"*(H+W)
for _ in xrange(H):
    s = raw_input()
    print "#"+s+"#"
print "#"*(H+W)

Submission status: Accepted

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

print('#'*(W+2))
for i in l:
    print('#' + i + '#')
print('#'*(W+2))

Submission status: Accepted

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

Submission status: Accepted

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

scr_list = [input() for _ in range(H)]

print('#' * (W+2))
for i in scr_list:
    print('#' + i + '#')
print('#' * (W+2))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    H, W = map(int, input().split())
    for i in range(W+2):
        print("#", end="")
    print()
    for i in range(H):
        print("#", end="")
        print(input(),end="")
        print("#")
    for i in range(W+2):
        print("#", end="")
    print()


    # Failed to predict input format
    pass

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

print("#"*(w + 2))
for s in l:
    print("#",s,"#",sep='')

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from typing import List


def answer(h: int, w: int, a: List[str]) -> List[str]:
    top_bottom_line = '#' * (w + 2)

    result = [top_bottom_line]
    for line in a:
        result.append(f'#{line}#')
    result.append(top_bottom_line)

    return result


def main():
    h, w = map(int, input().split())
    a = [input() for _ in range(h)]
    for i in answer(h, w, a):
        print(i)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#ABC062 B:PictureFrame

H,W = map(int, input().split())
pic = []
for _ in range(H):
    a = input()
    pic.append(a)
print('#'*(W+2))
for i in range(H):
    print('#' + pic[i] + '#')
print('#'*(W+2))

Submission status: Accepted

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

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

for i in range(h):
  s = input()
  print("#" + s + "#")

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

Submission status: Accepted

Solution code:
h,w=map(int,input().split())
huta=['#' for _ in range(w+2)]
huta=''.join(huta)
print(huta)
for _ in range(h):
    a=input()
    print('#{}#'.format(a))
print(huta)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    h,w= map(int, input().split())
    a = []
    for i in range(h):
        a.append(input())
    cnt = len(a[0])+2
    print("#" * cnt)
    for _ in a:
        print(f'#{_}#')
    print("#" * cnt)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
H, W = map(int, input().split())
L = ['#' + input() + '#' for _ in range(H)]
L = ['#' * (W + 2)] + L + ['#' * (W + 2)]
[print(i) for i in L]

Submission status: Accepted

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

Submission status: Accepted

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]
low = ''
for i in range(H+2):
  for j in range(W+2):
    low += ans[i][j]
  print(low)
  low = ''

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc152/tasks/abc152_c

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

row = '#' * (w + 2)

print(row)
for _ in range(h):
    print('#' + input() + '#')

print(row)

Submission status: Accepted

Solution code:
H,W = map(int,input().split())
a = ''
for i in range(W + 2):
  a += '#'
L = []
L.append(a)
for j in range(H):
  b = str(input())
  c = '#' + b + '#'
  L.append(c)
L.append(a)
for k in range(H + 2):
  print(L[k])

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
h,w=map(int,input().split())
S=[list(input()) for i in range(h)]
for i in range(h+2):
  for j in range(w+2):
    if i in [0,h+1] or j in [0,w+1]:
      print("#",end="")
    else:
      print(S[i-1][j-1],end="")
  print("")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
HW = input().split()

H = int(HW[0])
W = int(HW[1])

lst = []

for i in range(H):
   lst.append('#' + input() + '#')

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

for s in lst:
   print(s)

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

Submission status: Accepted

Solution code:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    strings=[]
    h,w = map(int,input().split())
    strings=[input().rstrip() for _ in range(h)]
    output=""

    for i in range(h+2):
        if i==0 or i==h+1:
            igeta="#"*(w+2)
            print("{}".format(igeta))
        else:
            output="#"+strings[i-1]+"#"
            print(output)

if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
x,y = map(int,input().split())
L = [list(input()) for _ in range(x)]
F = [['#']*(y+2) for _ in range(x+2)]
for i in range(x):
  for j in range(y):
    F[i+1][j+1] = L[i][j]
for f in F:
  print(''.join(f))

Submission status: Accepted

Solution code:
h, w = map(int, input().split())
words = [0]*(h+2)
for i in range(1, h+1, 1):
    s = input()
    words[i] = s

for j in range(len(words)):
    if words[j] == 0:
        words[j] = '#'*(w+2)
    else:
        words[j] = '#'+words[j]+'#'

for ans in words:
    print(ans)

Submission status: Accepted

Solution code:
h, w = map(int, input().split())
a = [input() for _ in range(h)]
for i in range(h+2):
    if i == 0 or i == h+1:
        print("#"*(w+2))
    else:
        print("#" + a[i-1] + "#")

Submission status: Accepted

Solution code:
H,W = map(int,input().split())
ls = [["#" for _ in range(W+2)]]

for _ in range(H):
  A = ["#"] + list(input()) + ["#"]
  ls.append(A)
  
ls.append(["#" for _ in range(W+2)])

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

Submission status: Accepted

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

print(''.join(['#']*(w+2)))
for a in a_l:
    print(''.join(a))
print(''.join(['#']*(w+2)))

Submission status: Accepted

Solution code:
H,W = map(int, input().split())
H += 2
W += 2
for i in range(H):
	if i == 0 or i == H-1:
		out = '#'*W
	else:
		a = input()
		out = '#{}#'.format(a)
	print(out)

Submission status: Accepted

Solution code:
h, w = map(int, input().split())
pixel = [[] for i in range(h+2)]
for i in range(h+2):
    if i == 0:
        pixel[i].append('#'*(w+2))
    elif i == h+1:
        pixel[i].append('#'*(w+2))
    else :
        pixel[i].append('#')
        s = input()
        pixel[i].append(s)
        pixel[i].append('#')
for i in range(h+2):
    print("".join(pixel[i]))

Submission status: Accepted

Solution code:
# B - Picture Frame
def main():
    h, w = map(int, input().split())

    for i in range(h):
        a = input()

        if i == 0:
            print(('#'*w)+'##')
            print('#'+a+'#')
        else:
            print('#'+a+'#')
    else:
        print(('#'*w)+'##')


if __name__ ==  "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
import copy
import math
import itertools
import numpy as np
l = [int(c) for c in input().split()]
H = l[0]
W = l[1]
a = [input() for c in range(H)]


print("#"*(W+2))
for i in range(H):
    print("#"+a[i]+"#")
print("#"*(W+2))

Submission status: Accepted

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

print('#'*(W+2))
for i in range(H):
    print(a[i])
print('#'*(W+2))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

h, w = map(int, input().split())
print('#' * (w + 2))
for i in range(h):
    print('#{}#'.format(input().strip()))
print('#' * (w + 2))

Submission status: Accepted

Solution code:
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    h, w = i_map()
    str_list = s_row_str(h)

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
with open(0) as f:
    H, W, *a = f.read().split()
W = int(W)
a.insert(0,'#'*W)
a.append('#'*W)
for x in a:
    print('#' + x.rstrip('\n') + '#')

Submission status: Accepted

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

Submission status: Accepted

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

    print("#" * (w + 2))
    for a in a_list:
        print("#" + a + "#")
    print("#" * (w + 2))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(H+2):
    if i == 0 or i == H+1:
        l = '#'*(W+2)
        res.append(l)
    else:
        a = input()
        a = '#' + a + '#'
        res.append(a)

for i in res:
    print(i)

Submission status: Accepted

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


frame = [['#' for _ in range(W+2)] for _ in range(H+2)]

mat = [['#' for _ in range(W)] for _ in range(H)]
for i in range(H):
    line = input()
    for j in range(W):
        mat[i][j] = line[j]

for i, row in enumerate(mat):
    for j, char in enumerate(row):
        frame[i+1][j+1] = char

for i in frame:
    for j in i:
        print(j, end="")
    print()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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):
  print("#"+a[i]+"#")
print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    H, W = map(int, readline().split())

    res = ["#" * (W + 2)]

    for _ in range(H):
        res += ["#" + input() + "#"]

    res += ["#" * (W + 2)]

    for row in res:
        print(row)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

print("#"*(w+2))
for i in range(h):
    a[i] = ["#"] + a[i] +["#"]
    print("".join(a[i]))
print("#"*(w+2))

Submission status: Accepted

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

d=[['#']*(w+2) for i in range(h+2)]
for i in range(h):
  for j in range(w):
    d[i+1][j+1]=a[i][j]
for i in range(h+2):
  print(*d[i],sep='')

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in range(h):
  num=input()
  print("#"+num+"#")
  
print("#"*(w+2))