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

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

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

    a_list = [list('#' * (w + 2))]
    for _ in range(h):
        temp = list(input())
        temp.insert(0, '#')
        temp.append('#')
        a_list.append(temp)
    a_list.append(list('#' * (w + 2)))
    
    for i in a_list:
        print(''.join(i))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

frame = '#'*(W+2)
print(frame)
for i in range(H):
    print('#'+input()+'#')
print(frame)

Submission status: Accepted

Solution code:
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]

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

tb = ['#' + input() + '#' for i in range(H)]
L = ''
for i in range(W+2):
	L = L +'#'

print(L)
for i in tb:
	print(i)
print(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:
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[i], "#"]
    print(''.join(tmp))

print(''.join(s))

Submission status: Accepted

Solution code:
h, w = list(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())
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: Accepted

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

Submission status: Accepted

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

for x in a:
    print('#' + ''.join(x) + '#')

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

Submission status: Accepted

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

for row in xs:
    print('#{}#'.format(row))

Submission status: Accepted

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

Submission status: Accepted

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

picture = []
for i in range(h):
  picture.append('#' + input() + '#')

picture.insert(0, '#' * (w + 2))
picture.append('#' * (w + 2))

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
"""
https://abc062.contest.atcoder.jp/tasks/abc062_b
"""
[h,w]=[int(i) for i in input().split()]
pic=[]
d=""
for i in range(h):
    pic.append([j for j in input().split()])
#print(pic)

for i in range(w+2):
    print("#",end="")
print("")
for i in range(h):
    d=d+str(pic[i][0])
    print("#"+d+"#")
    d=""
for i in range(w+2):
    print("#",end="")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

H, W = map(int, input().split())
HW = [list(input()) for i in range(H)]

# 入力より一回り大きい2次元配列を#埋めで準備
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] = HW[i][j]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Solution code:
H,W = map(int,input().split())
A = []
A.append("#"*(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,raw_input().split())
a=[raw_input() for r in xrange(H)]

print '#'*(1+W+1)
for ai in a:
  print '#'+ai+'#'
print '#'*(1+W+1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, w = map(int,input().split())
print('{}'.format('#'*(w + 2)))
a = '#'
for _ in range(n):
    b = a + input() + a
    print(b)
print('{}'.format('#'*(w + 2)))

Submission status: Accepted

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

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())
s = []
s.append('#'*(w+2))
for i in range(h):
    s.append('#'+input()+'#')
s.append('#'*(w+2))
for i in range(h+2):
    print(s[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())
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):
    print("#{}#".format(input()))

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

Submission status: Accepted

Solution code:
H, W = map(int,input().split())
A = []
A.append("#"*(W+2))

for k in range(H):
    A.append("#"+input()+"#")
A.append("#"*(W+2))

for r in A:
    print(r)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(h):
    picture.append(input())
    
print("#" * (w+2))

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

Submission status: Accepted

Solution code:
# coding: utf-8
a, b = map(int, input().split())

print('#' * b + '##')
for _ in range(a):
    image = input()
    print('#' + image + '#')
print('#' * b + '##')

Submission status: Accepted

Solution code:
H, W = map(int, raw_input().split())
across = '##'
for i in range(0, W):
	across = across + '#'
print across
for i in range(0, H):
	print '#' + raw_input() + '#'
print across

Submission status: Accepted

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

Submission status: Accepted

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

R = []
kabe = "".join(["#" for i in range(W+2)])
R.append(kabe)
for i in range(H):
    R.append("#"+input()+"#")
R.append(kabe)

for i in R:
    print(i)

Submission status: Accepted

Solution code:
H, W = map(int, input().split())
PF_list = [input() for _ in range(H)]
output="#"
for i in range(W+1):
    output += "#"
    
print(output)
for i in PF_list:
    print("#" + i + "#")
print(output)

Submission status: Accepted

Solution code:
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

h = int(arr_data[0][0])
w = int(arr_data[0][1])


s=""
s += (w+2)*"#"
s +="\n"

for i in range(1,1+h):
    
    s +="#"
    s += "".join(arr_data[i])
    s +="#\n"


s += (w+2)*"#"

print(s)

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 _ 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 i in range(h)]
for i in range(w + 1) :
    print("#", end="")
print("#")
for i in range(h) :
    print("#" + a[i] + "#")
for i in range(w + 1) :
    print("#", end="")
print("#")

Submission status: Accepted

Solution code:
def boxify(image, w):
    new = ['#' * (w + 2)]
    for row in image:
        new.append('#' + row + '#')
    new.append('#' * (w + 2))
    return new


if __name__ == '__main__':
    h, w = map(int, input().split())
    image = [input() for _ in range(h)]
    for row in boxify(image, w):
        print(row)

Submission status: Accepted

Solution code:
h, w = 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())
a = [input() for _ in range(h)]
a.insert(0, "#"*w)
a.append("#"*w)
for x in range(len(a)):
    print('#' + a[x] + '#')

Submission status: Accepted

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

# AtCoder Beginner Contest
# Problem B

if __name__ == '__main__':
    height, width = map(int, input().split())
    header = ''

    for _ in range(width + 2):
        header += header.join('#')

    print(header)

    for i in range(height):
        line = input()
        print('#' + line + '#')

    print(header)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import pprint

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

A = []
for _ in range(H):
    A.append(input())

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

Submission status: Accepted

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

for i in range(1+w):
    out += c
print(out)

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(W+2):
  if i==W+1:
    print("#")
  else:
    print("#",end="")
for i in range(H):
  print("#",end="")
  print(ans[i],end="")
  print("#")
for i in range(W+2):
  if i==W+1:
    print("#")
  else:
    print("#",end="")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
H, W = map(int, input().split())
pic = []
for i in range(H):
    pic.append(input())
print("".join(['#' for i in range(W + 2)]))
for i in range(H):
    print('#' + pic[i] + '#')
print("".join(['#' for i in range(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:
h,w = map(int,input().split())
a = []
for i in range(h):
	temp = input()
	atemp = []
	for k in range(w):
		atemp.append(temp[k])
	atemp.insert(0,'#')
	atemp.append('#')
	a.append(atemp)
add = ['#' for i in range(w+2)]
a.insert(0,add)
a.append(add)
for i in range(h+2):
	for k in range(w+2):
		if k != w+1:
			print(a[i][k],end='')
		else:
			print(a[i][k])

Submission status: Accepted

Solution code:
h,w=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())
sha=[]
s="#"
for i in range(w+2):
    sha.append("#")
print("".join(sha))
for i in range(h):
    s=s+input()+"#"
    print(s)
    s="#"
print("".join(sha))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Solution code:
H,W = [int(i) for i in input().split()]
A = [input().strip() for j in range(H)]
print('#' * (W+2))
for s in A:
  print('#' + s + '#')
print('#' * (W+2))

Submission status: Accepted

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

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

Ps=""
P=[]
for i in range(H):
    Ps+="#"
    Ps+=S[i]
    Ps+="#"
    P.append(Ps)
    Ps=""

print(Ts)
for i in range(H):
    print(P[i])
print(Ts)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h, w = [int(x) for x in input().split()]
p = []
for _ in range(h):
    p.append(list(input()))
print("#" * (w + 2))
for l in p:
    l[0:0] = "#"
    l[len(l):] = "#"
    print("".join(l))
print("#" * (w + 2))

Submission status: Accepted

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

Submission status: Accepted

Solution code:

h,w=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())
a=[]
for i in range(h):
    a.append(input())
print("#"*(w+2))
for i in a:
    print("#"+i+"#")
print("#"*(w+2))

Submission status: Accepted

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+2))
for s in moji:
    print('#'+s+'#')
print('#'*(w+2))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

list =''

for i in range(W+2):
	list +='#'
a = [input() for i in range(H)]

print(list)

for j in range(len(a)):
	a[j] ="#"+a[j]+"#"
	print(a[j])
	
print(list)

Submission status: Accepted

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

H,W=list( int(i) for i in input().split() )
a=[]
for i in range(0, H):
    a.append(input())

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

line()

for i in range(0, H):
    print("#"+a[i]+"#")

line()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
val = [int(x) for x in input().split()]

aaa = "#"
for i in range(val[1]+1):
    aaa = aaa + "#"

array = []
for i in range(val[0]):
    val = input()
    array.append("#" + val + "#")
print(aaa)
for j in array:
    print(j)
print(aaa)

Submission status: Accepted

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

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

Submission status: Accepted

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

a = []
for i 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:
list(map(print,(lambda a:['#'*len(a[0])]+a+['#'*len(a[0])])(['#'+input()+'#' for _ in range(list(map(int,input().split()))[0])])))

Submission status: Accepted

Solution code:
list(map(print, (lambda a:['#'*len(a[0])]+a+['#'*len(a[0])])(['#'+input()+'#' for _ in range(list(map(int, input().split()))[0])])))

Submission status: Accepted

Solution code:
H, W = map(int, input().split())
a = ["#"*(W+2)] + ["#"+input()+"#" for _ in range(H)] + ["#"*(W+2)]
print("\n".join(a))

Submission status: Accepted

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

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

Submission status: Accepted

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())) 
table=maketwodimarraywithwall(table,"#")
for i in table:
    print("".join(i))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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



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

    print("#" * (W+2))
    for _ in range(H):
        s = input()
        print("#", end="")
        print(s, end="")
        print("#")
    print("#" * (W+2))

if __name__ == "__main__": main()

Submission status: Accepted

Solution code:
H, W = [int(n) for n in input().split()]
a = []
for h in range(H):
  a.append(input())

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

Submission status: Accepted

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

print "".join(["#" for _ in range(w + 2)])
for _ in range(h):
    st = raw_input()
    print "#" + st +"#"
print "".join(["#" for _ in range(w + 2)])

Submission status: Accepted

Solution code:
# Problem D-D
H, W = [int(x) for x in input().strip().split(' ')]
image = []
for row in range(H):
    image.append(input().strip())
print("#" * (W + 2))
for i in range(H):
    print("#" + image[i] + "#")
print("#" * (W + 2))

Submission status: Accepted

Solution code:
def debug_print_joined(l):
    for col in l:
        print("".join(col))


def solve(): # Picture Frame
    H, W = list(map(int, input().split(" ")))
    A = []
    for _ in range(H):
        A.append(list(input()))

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

    A.insert(0, ["#" for _ in range(W + 2)])
    A.append(["#" for _ in range(W + 2)])

    debug_print_joined(A)


solve()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
http://abc062.contest.atcoder.jp/tasks/abc062_b

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    H, W = map(int, input().split())
    data = []
    for _ in range(H):
        data.append(input().strip())

    frame = ['#' * (W+2)]

    for d in data:
        frame.append('#' + d + '#')
    frame.append('#' * (W+2))

    for line in frame:
        print(line)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

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

print('#' * (W + 2))
for _ in range(H):
    print('#' + input() + '#')
print('#' * (W + 2))

Submission status: Accepted

Solution code:
x,y = map(int,input().split())
print("#"*(y+2))
for i in range(x):
    print("#{}#".format(input()))
print("#"*(y+2))

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())
for i in range(H+2):
    if i == 0 or i == H + 2 - 1:
        print('#' * (W + 2))
    else:
        a = input()
        print('#' + a + '#')

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(i) for i in 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:
H, W = list(map(int, input().split()))
print('#'*(W+2))
for i in range(H):
    a = input()
    print('#'+a+'#')
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())
array = list()
header = ""
for i in range(0, H):
    array.append("#" + input() + "#")
for i in range(0, W + 2):
    header += "#"

print(header)
for p in array:
    print(p)
print(header)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

dat = [input() for i in range(h)]
print("#" * (w+2))

print(*("#" + dat[i] + "#" for i in range(h)), sep="\n")
print("#" * (w+2))

Submission status: Accepted

Solution code:
def main():
    h, w = map(int, input().split())
    mat = [['#' for _ in range(w+2)] for _ in range(h+2)]

    inp = [[c for c in input()] for _ in range(h)]
    for i in range(1, h+1):
        for j in range(1, w+1):
            mat[i][j] = inp[i-1][j-1]

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
H, W = map(int, input().split())
string = list()
for i in range(H):
    string.append(input())

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

print("")

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

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

Submission status: Accepted

Solution code:
import sys
HW = map(int, raw_input().split())
text = []
for i in range(HW[0]):
	 text.append(raw_input())
for j in range(HW[1] + 2):
	sys.stdout.write('#')
print
for i in range(HW[0]):
	sys.stdout.write('#')
	sys.stdout.write(text[i])
	print('#')
for j in range(HW[1] + 2):
	sys.stdout.write('#')
print

Submission status: Accepted

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

l_n=[input() for i in range(H)]

for i in range(W+1):
    print('#',end='')
print('#')

for i in range(H):
    print('#{}#'.format(l_n[i]))

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

b = "#" * (w + 2)

print(b)
for i in range(h):
    ans = li[i]
    print("#" + ans + "#")

print(b)

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:
h, w = list(map(int, input().split(" ")))

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

Submission status: Accepted

Solution code:
# coding: utf-8
h, w = map(int, input().split())
pict =[]
for i in range(h):
    pict.append(input().rstrip())
    pict[i] = '#'+ pict[i] + '#'
pict.insert(0,'#'*(w+2))
pict.append('#'*(w+2))
for i in range(len(pict)):
    print(pict[i])

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    H,W = map(int, input().split())
    board = []
    for x in range(H):
        board.append(input())
    print ('#' * (W + 2))
    for y in range(H):
        print ('#' + board[y] + '#')
    print ('#' * (W + 2))

Submission status: Accepted

Solution code:
import sys

h, w = map(int, raw_input().split())
img = []
for i in range(h):
    r = raw_input()
    img.append(r)

print ''.join(['#'] * (len(img[0])+2))
for r in img:
    sys.stdout.write('#')
    sys.stdout.write(r)
    sys.stdout.write('#')
    print
print ''.join(['#'] * (len(img[0])+2))

Submission status: Accepted

Solution code:
l = list(map(int, input().split(' ')))
H = l[0]
W = l[1]

s = []
for i in range(H):
    a = str(input())
    s.append(a)

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

print('')
for j in s:
    print('#', end="")
    print(j, end="")
    print('#', end="")
    print('')

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