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:
from collections import deque
h,w=map(int,input().split())
print("#"*(w+2))
for i in range(h):
  d=input()
  print("#"+d+"#")
print("#"*(w+2))

Submission status: Accepted

Solution code:
H, W = map(int,input().split())
P = [input() for _ in range(H)]
S = ""
for i in range(W+2):
    S = S+"#"
for i in range(H+2):
    if i == 0 or i == H+1:
        print(S)
    else:
        print("#"+P[i-1]+"#")

Submission status: Accepted

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

answer = ""
for i in range(h + 2):
  if i == 0:
    answer += ''.join(["#" for i in range(w + 2)]) + "\n"
  elif i == h +1:
    answer += ''.join(["#" for i in range(w + 2)]) + "\n"
  else:
    answer += "#" + str(input()) + "#" + "\n"

print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
H, W = map(int,input().split())
print('#'*(W+2))
for _ in range(H):
    buffer = '#'+input()+'#'
    print(buffer)
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:
h,w=map(int,input().split())
a=["#"+input()+"#" for i in range(h)]
f=["#"]*(w+2)
print("".join(f))
for i in a:
    print(i)
print("".join(f))

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())
l = []
for i in range(H):
  l.append(str(input()))
ans = []
sharplist = '#' * (W+2)

ans.append(sharplist)
for i in range(H):
  ans.append('#' + l[i] + '#')
ans.append(sharplist)
      
for i in range(H+2):
  print(ans[i])

Submission status: Accepted

Solution code:
h,w=map(int,input().split())
A=[]
for i in range(h):
    a=list(input())
    A.append(a)
ans=''
for j in range(h+2):
    for k in range(w+2):
        if j==0 or j==h+1:
            ans+='#'
        else:
            if k!=0 and k!=w+1:
                ans+=A[j-1][k-1]
            else:
                ans+='#'
    print(ans)
    ans=''

Submission status: Accepted

Solution code:
def examB():
    H, W = LI()
    a = ["#"+S()+"#" for _ in range(H)]
    ans = "#"*(W+2)
    for i in range(H):
        ans += a[i]
    ans += "#"*(W+2)
    for i in range(H+2):
        print(ans[i*(W+2):(i+1)*(W+2)])

import sys
import copy
import bisect
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()

Submission status: Accepted

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

ls.append(['#']*(w+2))
for _ in range(h):
    ls.append(['#']+list(input())+['#'])
ls.append(['#']*(w+2))

for s in ls:
    print(*s, sep='')

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 range(h):
    print(a[i])
print("#"*(w+2))

Submission status: Accepted

Solution code:
# ABC 062: B – Picture Frame
h, w = [int(s) for s in input().split()]

a = []
for _ 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())
A = [str(input()) for i in range(H)]
A_sharp=['#'+i+'#' for i in A]
print('#' *(W+2))
for i in A_sharp:
    print(i)
print('#' *(W+2))

Submission status: Accepted

Solution code:
num = list(map(int, input().split(' ')))
tate = num[0]
yoko = num[1]
letters = [0 for i in range(tate)]

for i in range(tate):
    letters[i] = input()

ans = []
for letter in letters:
    ans.append("#" + str(letter) + "#")

print("#" * (yoko + 2))
for ans_letter in ans:
    print(ans_letter)
print("#" * (yoko + 2))

Submission status: Accepted

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

Submission status: Accepted

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-1] + '#'
for i in res:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

Solution code:
h, w = map(int, input().split())
a = [[c for c in input()] for i in range(h)]
print('#' * (w+2))
for i in range(h):
    a[i].insert(0, '#')
    a[i].append('#')
    print(''.join(a[i]))
print('#' * (w+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:
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(H, W, inputs):
    S = inputs
    for _ in range(W+2):
        print('#', end='')
    print('')

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

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


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    [H, W] = string_to_int(input())
    ret = solve(H, W, inputs(H))
    # print(ret)

Submission status: Accepted

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

h, w = [int(x) for x in lines[0].split()]
lines[0] = '#' * (w + 2)
for i in range(1, h+1):
    lines[i] = '#' + lines[i].rstrip() + '#'
lines.append('#' * (w + 2))

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

print('#' * (w+2))
for j in range(len(l)):
    print('#' + l[j] + '#')
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:
#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))




#62
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()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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().split() for _ in range(h)]
print('#'*(w+2))
for i in range(h):
    print('#' + a[i][0] + '#')
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))

print(*S, sep="\n")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main(h, w, a):
    print('#' * (w + 2))

    for s in a:
        print('#{}#'.format(s))

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


if __name__ == '__main__':
    h, w = map(int, input().split(' '))
    a = []

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

    main(h, w, a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
H, W = map(int, input().split())
S = []
print("#" * (W+2))
for i in range(H):
    s = input()
    print("#{}#".format(s))
print("#" * (W+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())

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()+'#')
A.append('#'*(W+2))
A.insert(0,'#'*(W+2))

for i in A:
    print(i)

Submission status: Accepted

Solution code:
H,W = map(int,input().split())
A = [["#" for _ in range(W+2)]]
for _ in range(H):
    row = list(input().strip())
    row.insert(0,"#")
    row.append("#")
    A.append(row)
A.append(["#" for _ in range(W+2)])
for i in range(H+2):
    print("".join(A[i]))

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('#', end='')
    print(a[i], end='')
    print('#')
print((W+2) * '#')

Submission status: Accepted

Solution code:
# ABC062 B - Picture Frame
H,W = map(int,input().split())
L = [[] for _ in range(H+2)]

for i in range(H+2):
    if i == 0 or i == H+1:
        a = '#'*(W+2)
        L[i].append(a)
        continue

    S = input()
    for j in range(len(S)):
        if len(S) == 1:
            if j == 0:
                L[i].append('#')
                L[i].append(S[j:j+1])
                L[i].append('#')
        else:
            if j == 0:
                L[i].append('#')
                L[i].append(S[j:j+1])
                continue
            if j == len(S)-1:
                L[i].append(S[j:j+1])
                L[i].append('#')
                continue
            L[i].append(S[j:j+1])

for l in L:
    print(*l,sep='')

Submission status: Accepted

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

Submission status: Accepted

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

a = '#'*(W+2)

print(a)
for i in range(0,H):
  s = input()
  print('#'+s+'#')
print(a)

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in range(w+1):
  print('#', end='')
print('#')
for i in range(h):
  print('#' + x[i] + '#')

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

Submission status: Accepted

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

for one_row in result_img:
  print(one_row)

Submission status: Accepted

Solution code:
from sys import exit, stdin
H, W = [int(_) for _ in stdin.readline().rstrip().split()]
print('#'*(W+2))
for i in range(H):
    A = stdin.readline().rstrip()
    print('#'+A+'#')
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+1:
        print('#'*(W+2))
    else:
        print('#'+input()+'#')

Submission status: Accepted

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

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

print('#' * (w+2))
for j in s_list:
  print('#' + j + '#')
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('#',end='')
    print(a[i],end='')
    print('#')

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

line=[]

for w in range(W+2):
  line.append('#')

print(''.join(line))

for h in range(H):
  print('#'+a_list[h]+'#')

print(''.join(line))

Submission status: Accepted

Solution code:
h,w = map(int,input().split())
sharp = ["#"] * (w+2)
print(*sharp, sep="")

pics = [input() for i in range(h)]

for pic in pics:
    print("#"+pic+"#")

print(*sharp,sep="")

Submission status: Accepted

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

list1=[[0 for i in range(w)] for i in range(h)]
list2=[[0 for i in range(w+2)] for i in range(h+2)]
for i in range(h):
    a=input()
    for j in range(w):
        list1[i][j]=a[j]

for i in range(h+2):
    for j in range(w+2):
        if i == 0 or i == h+1:
            list2[i][j] = '#'
        if j == 0 or j == w+1:
            list2[i][j] = '#'
        
        if list2[i][j] == 0:
            list2[i][j]=list1[i-1][j-1]
    
for i in list2:
    a=''.join(i)
    print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    h, w = list(map(int, input().rstrip('\n').split()))
    print("#" * (w + 2))
    for i in range(h):
        print("#" + str(input().rstrip('\n')) + "#")
    print("#" * (w + 2))


if __name__ == '__main__':
    slove()

Submission status: Accepted

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

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

for _ in range(h):
    res += ("#" + input() + "#" + "\n")

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

print(res)

Submission status: Accepted

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

print(*a, sep='\n')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h,w = list(map(int, input().split()))
print("#"*(w+2))
for i in range(h):
  print("#", input(), "#", sep="")
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(len(a)):
    print('#'+a[i]+'#')
print('#'*(w+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())

print(''.join(["#"]*(w+2)))

for i in range(h):
    a=input()
    print('#'+a+'#')

print(''.join(["#"]*(w+2)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
H,W = map(int,input().split())
s = []
n = ""
b = ""
a = []
for i in range(H):
  a.append(input())
for j in range(W+2):
  n += "#"
print(n)
for i in range(H):
  a[i] = "#"+a[i]+"#"
  print(a[i])
for j in range(W+2):
  b += "#"
print(b)

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())

temp1=["#"]*(w+2)
print("".join(temp1))

for i in range(h):
  temp=list(input().split())
  temp.insert(0,"#")
  temp.append("#")
  print("".join(temp))

print("".join(temp1))

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

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())
ans = []
ans.append('#' * (W + 2))
for _ in range(H):
    a = '#'+input()+'#'
    ans.append(a)
ans.append('#' * (W + 2))
ans = '\n'.join(ans)
print(ans)

Submission status: Accepted

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

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

print("#"*(m+2))
for i in range(n):
  print("#"+str(input())+"#")
print("#"*(m+2))

Submission status: Accepted

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

Submission status: Accepted

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

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:
import sys

#+++++
		
def main():
	h,w = map(int, input().split())
	print('#'*(w+2))
	for _ in range(h):
		s = '#'+input()+'#'
		print(s)
	print('#'*(w+2))		
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in range(h):
    pix = input()
    print('#' + pix + '#')

print('#' * width)

Submission status: Accepted

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


if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print("#"*(W+2))
for x in a:
    print(x)
print("#"*(W+2))

Submission status: Accepted

Solution code:
H, W = tuple(map(int, input().split()))
A = []
for h in range(H):
    A.append([c for c in input()])
res = [["#" for _ in range(W+2)] for _ in range(H+2)]
for i in range(1, H+1):
    for j in range(1, W+1):
        res[i][j] = A[i-1][j-1]
res = ["".join(x) for x in res]
res = "\n".join(res)
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    h,w=map(int,input().split(' '))
    maze = [[i for i in list(input())] for i in range(h)]
    upside = ['#']*(w+2)
    downside=['#']*(w+2)
    for i in upside:
        print(i,end='')
    print('')
    for i in maze:
        print('#',end='')
        for j in i:
            print(j,end='')
        print('#')
    for i in downside:
        print(i,end='')



if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

print('#' * (w + 2))
for v in picture:
    print('#' + v + '#')
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:
H, W = map(int, input().split())
A = ['#' + input() + '#' for _ in range(H)]
A = ['#' * (W+2)] + A + ['#' * (W+2)]
for i in range(H+2):
    print(A[i])

Submission status: Accepted

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)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

for _ in range(h):
    print('#', end='')
    row = list(input())
    print(''.join(row), end='')
    print('#')

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

Submission status: Accepted

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

print('#'*(W+2))
for h in range(H):
  print('#' + input().strip() + '#')
print('#'*(W+2))

Submission status: Accepted

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

a = '#'
for j in range(0,W+1):
    a += '#'
print(a)
for i in range(0,H):
    table[i].insert(0,'#')
    table[i].append('#')
    print("".join(table[i]))
print(a)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

m = "#"

l = []
for i in range(A):
  l.append(input())

ma = "#" * (B+2)

print(ma)

for i in l:
  print(m + i + m)

print(ma)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    H, W = map(int, input().split())
    a = [input().strip() for i in range(H)]

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

if __name__ == "__main__":
    main()

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 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)]

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

Submission status: Accepted

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

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

# solve & output
for i in range(H + 2):
    if i == 0 or i == H + 1:
        for _ in range(W + 2):
            if _ != W + 1:
                print('#', sep='', end='')
            else:
                print('#', sep='')
    else:
        for j in range(3):
            if j == 0:
                print('#', sep='', end='')
            elif j == 2:
                print('#', sep='')
            else:
                print(a[i - 1][0], sep='', end='')

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(H):
  ans += "#"
  ans += ans.join(input().split())
  ans += "#\n"

for i in range(W + 2):
  ans += "#"
ans += "\n"

print(ans)

Submission status: Accepted

Solution code:
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

H, W = ISI()
a = [["#"*(W+2)] for _ in range(H+2)]
for i in range(H):
    s = ["#" + IS() + "#"]
    a[i+1] = s
for i in range(H+2):
    print(*a[i])

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(len(a)):
    print(a[i])

Submission status: Accepted

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

Submission status: Accepted

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

for j in range(H):
    a[j].insert(0, '#')
    a[j].append('#')

a.append('#' * (W + 2))
a.insert(0, '#' * (W + 2))

for k in range(H + 2):
    print(''.join(a[k]))

Submission status: Accepted

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

s = list([input() for _ in range(H)])

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

Submission status: Accepted

Solution code:
def resolve():
    h,w=map(int,input().split())
    A=['#'+input()+'#' for _ in range(h)]
    print('#'*(w+2))
    print(*A,sep='\n')
    print('#'*(w+2))
resolve()

Submission status: Accepted

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