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:
h, w = map(int, input().split())
an = [ input() for _ in range(h)]

answers = []

sharpColumn = ""
for _ in range(len(an[0])+2):
  sharpColumn += "#"

answers.append(sharpColumn)
for a in an:
  add = "#"
  for index in range(len(a)):
    if index == len(a)-1:
      add += a[index]+"#"
    else:
      add += a[index]
  answers.append(add)

answers.append(sharpColumn)

for answer in answers:
  print(answer)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
List = []
mid = ""
for i in range (a):
  List.append(input())
resList = []
for i in range(a+2):
  if i == 0 or i == a+1:
    for j in range(b+2):
      mid += "#"
    resList.append(mid)
    mid = ""
  else:
    mid = "#"+List[i-1]+"#"
    resList.append(mid)
    mid = ""
for element in resList:
  print(element)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#

import sys
input=sys.stdin.readline

def main():
    H,W=map(int,input().split())
    print("".join(["#"]*(W+2)))
    for i in range(H):
        print("#",input().strip("\n"),"#",sep="")
    print("".join(["#"]*(W+2)))
    
if __name__=="__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def actual(H, W, A):
    answer = ''

    answer += '#' * (W + 2) + '\n'

    for a in A:
        answer += f'#{a}#\n'

    answer += '#' * (W + 2)

    return answer

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

print(actual(H, W, A))

Submission status: Accepted

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

print('#' * (w + 2))
for a_row in a:
    print('#' + a_row + '#')
print('#' * (w + 2))

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

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

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())
a=[input() for _ in range(h)]
print('#'*len(max(a))+'##')
for s in a:
    print('#'+s+'#')
print('#'*len(max(a))+'##')

Submission status: Accepted

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

for i in range(H):
    for j in range(W):
        ans[i+1][j+1] = A[i][j]

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

Submission status: Accepted

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

Submission status: Accepted

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

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

strings = []

for i in range(h):
    p = input()
    strings.append(p)

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

print('')


for i in range(h):
    print('#', end='')
    print(strings[i], end='')
    print('#')

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

Submission status: Accepted

Solution code:
import sys
def LI():
    return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def S(): 
    return sys.stdin.readline().rstrip()

H,W = LI()

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

for i in range(H):
    print('#' + S() + '#')

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

Submission status: Accepted

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

w1 = ['#']*(w+2)

ans = []
ans.append(w1)

for i in range(h):
    tmp = ["#"]+list(input())+["#"]
    ans.append(tmp)

ans.append(w1)

for j in ans:
    for k in j:
        print(k, end="")
    print()

Submission status: Accepted

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    H, W = il()
    A = [iss() for _ in range(H)]

    print('#' * (W + 2))
    for a in A:
        str = '#' + a + '#'
        print(str)
    print('#' * (W + 2))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
hw,*aaa = open(0).read().splitlines()

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

print('#'*(w+2))
for aa in aaa:
    print(f'#{aa}#')
print('#'*(w+2))

Submission status: Accepted

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

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

print('#'*(w+2))
for f in field:
    print('#'+f+'#')
print('#'*(w+2))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h,w=map(int,input().split())
A=[list(input()) for i in range(h)]
B=[['#' for i in range(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 b in B:
    print(''.join(b))

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(H):
  tmp = str(input())
  con.append(tmp)

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
#!/usr/bin/env python3
(h, w), *p = [i.split() for i in open(0)]
h = int(h)
w = int(w)+2
print("#" * w)
for i in p:
    print("#{}#".format(*i))
print("#" * w)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

print("#"*(W+2))
for h in range(H):
    for w in range(len(A[h])):
        print(A[h][w], 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()+"#")
  
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())
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())
print('#' * (w + 2))
for i in range(h):
  print('#' + input() + '#')
print('#' * (w + 2))

Submission status: Accepted

Solution code:

H,W = map(int,input().split())
st = ['#' + str(input()) +'#' for _ in range(H)]
st = ['#'*(W+2)] + st + ['#'*(W+2)]
print(*st,sep='\n')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

print('#'*(w+2))
for i in a:
    ans = '#'+i+'#'
    print(ans)
print('#'*(w+2))

Submission status: Accepted

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

for i in range(H+2):
  if i == 0 or i == H+1:
    print('#'*(W+2))
  else:
    s= '#'+ input() + '#'
    print(s)

Submission status: Accepted

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

Submission status: Accepted

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


def read():
    H, W = map(int, input().strip().split())
    A = []
    for i in range(H):
        a = list(input().strip())
        A.append(a)
    return H, W, A


def solve(H, W, A):
    B = [["#" for j in range(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("".join(B[i]))


if __name__ == '__main__':
    inputs = read()
    solve(*inputs)

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 = list(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())
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):
    a = input()
    print('#' + a + '#')
print('#' * (w + 2))

Submission status: Accepted

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

Submission status: Accepted

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

print("#" * (w + 2))
for f in field:
    print(f"#{''.join(f)}#")
print("#" * (w+2))

Submission status: Accepted

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

Submission status: Accepted

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

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

for s in S:
    print(s)

Submission status: Accepted

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

Submission status: Accepted

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

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

l = []

l.append('#' * (W + 2))

for i in range(H):
    s = str(input())
    l.append('#' + s + '#')

l.append('#' * (W + 2))

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

Submission status: Accepted

Solution code:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

h,w = i2()
a = ""
for _ in range(w+2):
	 a += "#"
print(a)
b = "#"
for i in range(h):
	c = s()
	b += c + "#"
	print(b)
	b = "#"
print(a)

Submission status: Accepted

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

# list_n = list(map(int, input().split()))

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]

import sys
input = sys.stdin.readline

H, W = map(int, input().split())
pic = [['#' for i in range(W+2)] for j in range(H+2)]

for i in range(H):
    S = input()
    for j in range(W):
        S1 = S[j]
        pic[i+1][j+1] = S1

for i in range(H+2):
    for j in range(W+2):
        print(pic[i][j], end="")
    print('', end='\n')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
H, W = [int(i) for i in input().split()]
S = [input() for _ in range(H)]
for j in range(W + 2):
    print('#', end='')
print()
for i in range(H):
    print('#%s#' % S[i])
for j in range(W + 2):
    print('#', end='')
print()

Submission status: Accepted

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

print('#'*(w+2))
for i in range(h):
  line = input()
  print(f'#{line}#')
print('#' * (w+2))

Submission status: Accepted

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

print("#" * (W + 2))
for _ in range(H):
    line = input()
    print(f"#{line}#")
print("#" * (W + 2))

Submission status: Accepted

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

print((W+2)*"#")
for h in range(H):
  print("#"+input()+"#")
print((W+2)*"#")

Submission status: Accepted

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

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

Submission status: Accepted

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

main()

Submission status: Accepted

Solution code:
import sys
H,W = map(int,input().split())
if H < 0 or H > 100 or W < 0 or H > 100:
    sys.exit()
pixeles = []
for I in range(H):
    pixeles.append(str(input()))

print("#"*(W+2))
for L in pixeles:
    print("#",end='')
    print(L,end='')
    print("#")
print("#"*(W+2))

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    H, W = [int(i) for i in input().split()]
    aa = [input() for _ in range(H)]
    print("".join(["#" for _ in range(W + 2)]))
    for r in range(H):
        print("#" + aa[r] + "#")
    print("".join(["#" for _ in range(W + 2)]))


resolve()

Submission status: Accepted

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

print ("#"*(w+2))
for line in grid:
    print ("#",end="")
    print(''.join(map(str, line)),end="")
    print ("#")
print ("#"*(w+2))

Submission status: Accepted

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

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

for i in range(h):
    print('#' + ary[i] + '#')

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

Submission status: Accepted

Solution code:
h, w = (int(i) for i in input().split())
image = ["#" + input() + "#" for _ in range(h)]

print("#" * (w + 2))
print("\n".join(image))
print("#" * (w + 2))

Submission status: Accepted

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

print("".join(sharp))
for j in range(h):
  a = list(input())
  a.append("#")
  a.insert(0,"#")
  print("".join(a))
print("".join(sharp))

Submission status: Accepted

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

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())
lis = ["#" + input() + "#" for _ in range(H)]
s = "#" * (W+2)

lis.append(s)
lis.insert(0, s)

for i in lis:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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))
print(*a, sep='\n')

Submission status: Accepted

Solution code:
#!python3

LI = lambda: list(map(int, input().split()))

# input
H, W = LI()
A = ["#" + input() + "#" for _ in range(H)]


def main():
    x = ["#" * (W + 2)]
    ans = x + A + x
    print("\n".join(ans))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(H):
    a = [input()]
    a.insert(0,"#")
    a.append("#")
    ma.append(a)

x = "#"*(W+2)

print(x)
for i in range(H):
    print("".join(ma[i]))  
print(x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

# In[7]:


H,W = map(int, input().split())
ans = ["#"*(W+2)]
for _ in range(H):
    ans.append("#"+input()+"#")
ans.append("#"*(W+2))
for col in ans:
    print(col)


# In[ ]:

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())
lines = [input() for i in range(H)]

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

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

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

Submission status: Accepted

Solution code:
H, W = map(int, input().split())
a = [input()for _ in range(H)]
print("#"*(W+2))
for r in a:
    print("#"+r+"#")
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:
def resolve():
    H, W = map(int, input().split())
    ans = []
    for _ in range(H):
        a = input()
        ans.append(a)
    print("#"*(W+2))
    for j in range(H):
        print("#"+ans[j]+"#")
    print("#"*(W+2))
resolve()

Submission status: Accepted

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

for i in range(H):
    print(grid[i*W:(i+1)*W])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    H, W = map(int, input().split())
    grid = []
    grid.append(['#']*(W+2))
    for _ in range(H):
        grid.append(['#'] + list(input()) + ['#'])
    grid.append(['#']*(W+2))
    
    for g in grid:
        print(''.join(g))

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
h, w = map(int, input().split())
a = list(str(input()) for i in range(h))
s =[]
for j in range(w+2):
    s.append("#")
print(*s, sep="")
p = []
for k in range(h):
    p.append("#")
    p.append(a[k])
    p.append("#")
    print(*p, sep="")
    del p[:]
print(*s, sep="")

Submission status: Accepted

Solution code:
# 2020/06/10
# AtCoder Beginner Contest 062 - B

# Input
h, w = map(int,input().split())
header = ['#'] * (w+2)
print(''.join(header))

# Calc
for i in range(h):
    instr = input()
    wstr = '#' + instr + '#'
    print(wstr)

print(''.join(header))

Submission status: Accepted

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

for i in range(n+2):
    for j in range(m+2):
        if i==0 or i==n+1 or j==0 or j==m+1:
            print('#',end='')
        else:
            print(s[i-1][j-1],end='')
        if j==m+1:
            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=[list(input()) for _ in range(H)]

ans=[["#"]*(W+2) for _ in range(H+2)]
for i in range(1,H+1):
    for j in range(1,W+1):
        ans[i][j]=A[i-1][j-1]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def process(H, W) : 
  str = '#' * (W + 2)
  print(str)
  for i in range(H) : 
    s = '#'
    s += input()
    s += '#'
    print(s)
  print(str)


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

Submission status: Accepted

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

print("#"+s,a+s,sep="\n")

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 math
from collections import deque
from collections import defaultdict

#自作関数群
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq
def get_sieve_of_eratosthenes(n):
	#data = [2]
	data = [0,0,0]
	for i in range(3,n+1,2):
		data.append(i)
		data.append(0)
	for i in range(len(data)):
		interval = data[i]
		if interval!=0:
			for j in range(i+interval,n-1,interval):
				data[j] = 0
	#ans = [x for x in data if x!=0]
	ans = data[:]
	return ans



h,w = readInts()
print("#"*(w+2))
a = []
for i in range(h):
	print("#",end="")
	print(readChar(),end="")
	print("#")




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

    image = list()
    image_line = ""
    for i in range(h):
        image_line = input()
        image_line = "#" + image_line + "#"
        image.append(image_line)

    sharp_line = ""
    for i in range(w + 2):
        sharp_line += "#"
    
    image.insert(0, sharp_line)
    image.append(sharp_line)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

for j in range(h):
  result = "#"
  s = input()
  result += s
  result += "#"
  print(result)
result =""
for i in range(w+2):
  result += "#"
print(result)