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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

return_list = []

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
h, w  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()
 
print('{}'.format('#' * (w + 2)))
for _ in range(h):
    print('#{}#'.format(input()))
print('{}'.format('#' * (w + 2)))

Submission status: Accepted

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

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

ls = "#" * (W+2)
print(ls)

for i in range(H):
    print("#" + input() + "#")

print(ls)

Submission status: Accepted

Solution code:
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**6)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
# endregion
H, W = ri_()
a = ['#' * (W + 2)]
for _ in range(H):
    a.append('#' + rs() + '#')
a.append('#' * (W + 2))
for i in range(H + 2):
    print(a[i])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a = [input() for _ in [0]*h]

for _ in [0]*(w+2):
  print('#',end='')
print()
for i in range(h):
  print('#',end='')
  print(a[i],end='')
  print('#')

for _ in [0]*(w+2):
  print('#',end='')
print()

Submission status: Accepted

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

Submission status: Accepted

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

b_list = a_list.copy()

for i in range(h):
    sharp = ["#"] * (w+2)
    sharp = "".join(sharp)
    if i == 0:
        b_list.insert(0, sharp)
    if i == h-1:
        b_list.append(sharp)
    
    replace = str('#') + str(a_list[i]) + str('#')
    b_list[i+1] = replace

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

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:
import sys, heapq, bisect, math, fractions
from collections import deque

H, W = map(int, input().split())
A = [list(sys.stdin.readline().strip()) for _ in range(H)]

print("#" * (W + 2))
for i in range(H):
    res = "".join(A[i])
    print("#" + res + "#")
    # print(A[i])
print("#" * (W + 2))

Submission status: Accepted

Solution code:
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    H,W=map(int,readline().split())
    a=["#"*(W+2)]
    for i in range(H):
        s=readline().strip()
        s="#"+s+"#"
        a.append(s)
    a.append("#"*(W+2))
    
    for i in range(H+2):
        print(a[i])

if __name__=="__main__":
    main()

Submission status: Accepted

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

ans_map = [['#'*(w+2)]]
for i in range(h):
    s = input()
    ans_map.append(['#'+s+'#'])
ans_map.append(['#'*(w+2)])

for ans in ans_map:
    print(ans[0])

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 j in range(h+2):
        print(a[j])

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    H,W=map(int,input().split())
    print('#'*(W+2))
    for _ in range(H):
        print('#'+str(input())+'#')
        
    print('#'*(W+2))

    
resolve()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

INF = float("inf")

def myinput():
    return map(int,input().split())

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

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

b = ["#"]*(w+2)
myoutput(b,False)
for i in range(h):
    c = "#" + a[i] + "#"
    myoutput(c,False)
myoutput(b,False)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

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

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == "__main__":
  resolve()

Submission status: Accepted

Solution code:
import numpy as np
import functools
import math
import collections
import scipy
import fractions
import itertools

def solve():
    h, w = map(int, input().split())
    hoge = []
    for i in range(h):
        hoge.append(input())
    print("#"*(w+2))
    for i in range(h):
        print("#"+hoge[i]+"#")
    print("#"*(w+2))
    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

ue = "#" * (W+2)
l = []
for i in range(H):
    x = input()
    x = "#" + x + "#"
    l.append(x)
    
print(ue)
for i in l:
    print(i)
print(ue)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

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

G = [['#'] * (W + 2)]
for _ in range(H):
    G.append(['#'] + list(input()) + ['#'])

G.append(['#'] * (W + 2))

for tmp in G:
    print (*tmp, sep = '')

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
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()
h,w=MI()
for i in range(w+2):
    print("#",end="")
print("")
for i in range(h):
    print("#",end="")
    print(input().rstrip(),end="")
    print("#")
for i in range(w+2):
    print("#",end="")

Submission status: Accepted

Solution code:
h, w = map(int, input().split())
A = ['#' +str(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())
a = [input() for _ in range(h)]

ans = [""] * (h+2)
ans[0] = "#" * (w+2)
ans[-1] = "#" * (w+2)
for i in range(h):
  ans[i+1] = "#" + a[i] + "#"
for v in ans: print(v)

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))

def main():
    h,w = readInts()
    maze = [input() for _ in range(h)]
    print('#'*(w+2))
    for i in range(h):
        print('#' + maze[i] + '#')
    print('#'*(w+2))
if __name__ == '__main__':
  main()

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:
#import sys
#input = sys.stdin.readline
from collections import *

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 _ in range(h):print("#"+input()+"#")
print("#"*(w+2))

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

ans=['#'*(W+2)]+['']*(H+1)
i=1
while i<=H:
    ans[i]='#'+input()+'#'
    i+=1
ans[H+1]='#'*(W+2)

for j in ans:
    print(j)

Submission status: Accepted

Solution code:
h, w = map(int, input().split())
a = []
for _ in range(h):
    a.append(input().strip())
haji = ''.join(['#' for _ in range(w + 2)])
print(haji)
for elem in a:
    print('#' + elem + '#')
print(haji)

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:
import sys
def input(): return sys.stdin.readline().strip()

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

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:
a, b = map(int, input().split())
print("#"*(b+2))
for i in range(a):
  c = input()
  print("#"+c+"#")
print("#"*(b+2))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
H, W = MAP()

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

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

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

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

Submission status: Accepted

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

mat=[["#"]*(W+2)]
for i in range(H):
  array=["#"]+list(input())+["#"]
  mat.append(array)
mat.append(["#"]*(W+2))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

h,w=MI()
for i in range(w+2):
    print("#",end="")
print("")
for j in range(h):
    print("#",end="")
    print(input().rstrip(),end="")
    print("#")
for i in range(w+2):
    print("#",end="")

Submission status: Accepted

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

Submission status: Accepted

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

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:
import sys
readline = sys.stdin.readline

def main():
    H, W = map(int, readline().rstrip().split())
    ans = [['#']*(W+2)] + [['#']+readline().rstrip().split()+['#'] for _ in range(H)] + [['#']*(W+2)]
    ans = [''.join(l) for l in ans]
    print(*ans, sep='\n')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h,w=map(int,input().split())
a=[]
for _ in range(h):
    s=input()
    a.append(s)
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=input().split()
h=int(h)
ch='#'
w=int(w)
lt=[]
for i in range(h):
    a = []
    a.append(input())
    lt.append(a)
for j in range(w+2):
    print(ch,end='')
print()
for i in range(h):
    for j in range(w):
        if j==0:
            print(ch,end='')
        print(lt[i][0][j],end='')
        if j==w-1:
            print(ch,end='')
    print()
for j in range(w+2):
    print(ch,end='')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
dimension = list(map(int, input().split()))
h = dimension[0] + 2
w = dimension[1] + 2

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

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):
    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 i in range(H):
  tmp = input().split()
  ans = '#'
  for l in tmp:
    ans += l
  ans += '#'
  print(ans)
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())
l = []
for _ 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:
h,w = map(int, input().split())
S = [input() for i in range(h)]
print('#'*(w+2))
for s in S:
    print('#'+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:
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
## dp ##
def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d1)]
## math ##
def to_bin(x: int) -> str: return format(x, 'b') # rev => int(res, 2)
def to_oct(x: int) -> str: return format(x, 'o') # rev => int(res, 8)
def to_hex(x: int) -> str: return format(x, 'x') # rev => int(res, 16)
MOD=10**9+7
def divc(x,y) -> int: return -(-x//y)
def divf(x,y) -> int: return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def enumerate_divs(n):
    """Return a tuple list of divisor of n"""
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers n or less"""
    is_prime = [True]*(MAX_NUM+1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(MAX_NUM**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i*2, MAX_NUM+1, i):
            is_prime[j] = False
    return [i for i in range(MAX_NUM+1) if is_prime[i]]
## libs ##
from itertools import accumulate as acc
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left
#======================================================#

def main():
    h, w = MII()
    s = ['#'*(w+2)]
    for i in range(h):
        s.append('#'+ IS() + '#')
    s.append('#'*(w+2))
    print(*s,sep='\n')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

ans = []
topdown = ""

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

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

ans.append(topdown)
for i in range(h):
    ans.append(a[i])
ans.append(topdown)

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

Submission status: Accepted

Solution code:
H,W=map(int,input().split())
a=[list(input()) for _ 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("\n")

Submission status: Accepted

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

print(pad)
for p in pic:
  print(p)
print(pad)

Submission status: Accepted

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

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:
import numpy as np
import sys

input = sys.stdin.readline

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

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

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

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

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
h,w=map(int,input().split())
answer=["#"*(w+2)]
for _ in range(h):
    answer.append("#"+input()[:-1]+"#")
answer.append("#"*(w+2))
print(*answer,sep="\n")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque
h, w = map(int, input().split())
li = [input() for _ in range(h)]
for i in range(h):
    li[i] = '#' + li[i] + '#'
d = deque(li)
d.appendleft('#'*(w+2))
d.append('#'*(w+2))
for s in d:
    print(s)

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc062/tasks/abc062_b
h, w = map(int, input().split())

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

for r in matrix:
    print(''.join(r))

Submission status: Accepted

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

Submission status: Accepted

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

w = [str(input()) for i in range(W)]
#print(w)

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(H):
    a[i] = input()

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

Submission status: Accepted

Solution code:
def resolve():
    H, W = list(map(int, input().split()))
    A = ["#"+input()+"#" for i in range(H)]
    sharpline = "".join(["#" for i in range(W+2)])
    [print(line) for line in [sharpline]+A+[sharpline]]




if '__main__' == __name__:
    resolve()

Submission status: Accepted

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

for i in range(H+2):
  for j in range(W+2):
    if j<W+1: print(S[i][j],end='')
    else: print(S[i][j])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    H, W = map(int, input().split())
    res = [["#"] * (W + 2)]
    for _ in range(H):
        a = list(input())
        res.append(["#"] + a + ["#"])
    res.append(["#"] * (W + 2))
    for i in res:
        print("".join(i))


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
def resolve():
	h, w = map(int, input().split())
	ans = [['#']*(w+2) for _ in range(h+2)]
	for i in range(1, h+1):
		r = input()
		for j in range(1, w+1):
			ans[i][j] = r[j-1]
	for r in ans:
		print("".join(r))
resolve()

Submission status: Accepted

Solution code:
# Problem B - Picture Frame

# input
H, W = map(int, input().split())
a_list = [['']*W for i in range(H)]
for i in range(H):
    a_nums = list(input())
    for j in range(W):
        a_list[i][j] = a_nums[j]

# output
ans = "#"*(W+2)
ans += "\n"
for i in range(H):
    ans += "#"
    for j in range(W):
        ans += a_list[i][j]
    ans += "#\n"
ans += "#"*(W+2)
print(ans)

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().split()) for _ in range(H)]

s = []
for i in range(W + 2):
    s.append('#')

for i in range(H + 2):
    if (i == 0):
        print(''.join(s))
    elif (i > 0 and i < H + 1):
        print('#' + ''.join(A[i - 1]) + '#')
    elif (i == H + 1):
        print(''.join(s))

Submission status: Accepted

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


if __name__ == '__main__':
    main()