Problem:


Score : 200 points

Problem Statement

You are given a image with a height of H pixels and a width of W pixels.
Each pixel is represented by a lowercase English letter.
The pixel at the i-th row from the top and j-th column from the left is a_{ij}.

Put a box around this image and output the result. The box should consist of # and have a thickness of 1.

Constraints

1 ≤ H, W ≤ 100

a_{ij} is a lowercase English letter.

Input

Input is given from Standard Input in the following format:

H W
a_{11} ... a_{1W}
:
a_{H1} ... a_{HW}

Output

Print the image surrounded by a box that consists of # and has a thickness of 1.

Sample Input 1

2 3
abc
arc

Sample Output 1

#####
#abc#
#arc#
#####

Sample Input 2

1 1
z

Sample Output 2

###
#z#
###



Sample input:
2 3
abc
arc


Sample output:
#####
#abc#
#arc#
#####

Submission status: Accepted

Solution code:
# coding: utf-8

height, width = map(int, input().split())

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

for j in range(height):
    print("#", end='')
    str = input()
    print(str, end='')
    print("#")


for l in range(width+2):
    print("#", end='')

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

Submission status: Accepted

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

Submission status: Accepted

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

s = "#" * (w+2)

print(s)
for i in range(h):
    t = input()
    print("#", end="")
    print(t, end="#\n")
print(s)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

print('#' * (w+2))
for i in range(h):
    data = list(map(str, input().split()))
    data2 = ['#'] + data + ['#']
    print(''.join(data2))


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 solve():
    H, W = [int(i) for i in input().split()]
    print("#" * (W + 2))
    for _ in range(H):
        print(f"#{input()}#")
    print("#" * (W + 2))

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
def resolve():
    '''
    code here
    '''
    H, W = [int(item) for item in input().split()]
    grid = [input() for _ in range(H)]
    
    print('#'*(W+2))
    for line in grid:
        print('#' + line + '#')
    print('#'*(W+2))

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

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

Submission status: Accepted

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

print('#'*(W+2))
for line in lines:
    print('#' + line + '#')
print('#'*(W+2))

Submission status: Accepted

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

Submission status: Accepted

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


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    H, W = map(int, input().split())
    print("#"*(W+2))
    for _ in range(H):
        print("#{}#".format(input()))
    print("#"*(W+2))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
print(*['#'*-~-~m]+['#'+input()+'#' for _ in range(n)]+['#'*-~-~m],sep='\n')

Submission status: Accepted

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

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 _ in range(h)]
l = []
for i in range(h):
    a[i].insert(0,'#')
    a[i].insert(w+1,'#')

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush

def main():
    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))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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):
  for j in range(W+2):
    if 1 <= i <= H and 1 <= j <= W:
      ans += a[i-1][j-1]
    else:
      ans += '#'
  ans += "\n"
print(ans)

Submission status: Accepted

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

h,w = m()

data = [input()[:-1] for i in range(h)]

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

for i in range(h):
    print("#" + data[i] + "#")

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

Submission status: Accepted

Solution code:
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

h,w=nii()

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)
for _ in [0]*h:
    print('#'+input()+'#')
print('#'*-~-~w)

Submission status: Accepted

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

for s in range(-1,H+1):
    for t in range(-1,W+1):           
        if s==-1 or s==H:
            print("#"*(W+2))
            break
        else:
            if t==-1:
                print("#",end="")
            elif t==W:
                print("#")
            else:
                print(a[s][t],end="")

Submission status: Accepted

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

Submission status: Accepted

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

W += 2
f = '#'
print(f * W)
for a in A:
    print(f'#{a}#')
print(f * W)

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = []

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

ans.append(top)

for i in range(H):
    t = list(input())
    t = ['#'] + t + ['#']
    ans.append(t)

ans.append(top)

for aa in ans:
    print(''.join(map(str,aa)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

H, W = map(int, sys.stdin.readline().split())
print("#" * (W + 2))
for _ in range(H):
    s = sys.stdin.readline().strip()
    print("#" + s + "#")
print("#" * (W + 2))

Submission status: Accepted

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

ans.append('#'*(w+2))
for i in range(h+2):
    print(ans[i])

Submission status: Accepted

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

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

    print('#' + input() + '#')

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

Submission status: Accepted

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

for i in range(h):
    grid[i + 1] = ["#"] + list(map(str, input().rstrip())) + ["#"]

for i in range(h + 2):
    print("".join(grid[i]))

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

h,w = inpl()
s = [input() for _ in range(h)]
res = []
for i in range(h+2):
    if i == 0 or i == h+1:
        res.append('#' * (w+2))
    else:
        res.append('#' + s[i-1] + '#')
for x in res:
    print(x)

Submission status: Accepted

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

Submission status: Accepted

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

top = '#'*(w+2)
print(top)
for a in al:
    print(a)
print(top)

Submission status: Accepted

Solution code:
H,W = map(int,input().split())
A = [input() for i 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 ())
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())

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

for i in a:
    i.insert(0,'#')
    i.append('#')
    
print('#'*(W+2))
for i in a:
    print(''.join(i))
print('#'*(W+2))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
H, W = map(int, input().split())
a = ['#' * (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:
y,x = map(int,input().split())
for i in range(x+1):
    print("#",end = "")
print("#")
for i in range(y):
    print("#"+input()+"#")
for i in range(x+1):
    print("#",end = "")
print("#")

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def resolve():
    import sys
    input = sys.stdin.readline
    # row = [int(x) for x in input().rstrip().split(" ")]
    # n = int(input().rstrip())
    # s = input().rstrip()

    h, w = [int(x) for x in input().rstrip().split(" ")]

    print("".join(["#" for _ in range(w+2)]))

    for i in range(h):
        print("#"+input().rstrip()+"#")

    print("".join(["#" for _ in range(w+2)]))

if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#B - Picture Frame 
H,W = map(int,input().split())
a = []
for _ in range(H):
    ai = list(map(str,input()))
    a.append(ai)

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

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

Submission status: Accepted

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

Submission status: Accepted

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

print("#" * (W + 2))
for j in range(H):
    print("#" + pic[j][0] + "#")
print("#" * (W + 2))

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    H, W = LI()
    a = [SS() for _ in range(H)]

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

if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
H,W = map(int,input().split())
print('#'*(W+2))
for i in range(H):
    pixel = input()
    print(f'#{pixel}#')
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:
from collections import deque
h,w = map(int,input().split())
s = "#"

print(s*(w+2))

for i in range(h):
    lst = deque(list(map(str,input().split())))
    lst.appendleft("#")
    lst.append("#")
    print("".join(lst))

print(s*(w+2))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

h, w = rm()
print('#' * (w+2))
for _ in range(h):
    print('#' + rr() + '#')
print('#' * (w+2))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(H):
    pic.append("#" + input() + "#")

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

for i in pic:
    print(i)

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

Submission status: Accepted

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


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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

print("\n".join(A))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

h, w = inintm()

pixel = []
f = ""
l = ""

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

pixel.append(f)

for i in range(h):
    pixel.append("#" + input() + "#")

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

pixel.append(l)

for x in pixel:
    print(x)

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]


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):
            print("#", end="")
        else:
            if (j == 0 or j == w+1):
                print("#", end="")
            else:
                print(a[i-1][j-1], end="")
    print("")

Submission status: Accepted

Solution code:
h, w = map(int, input().split())
htop = '#' * (w+2)
grid = [htop]
for _ in range(h):
    grid.append('#' + str(input()) + '#')
else:
    grid.append(htop)
print(*grid, sep='\n')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

h,w = [int(x) for x in stdin.readline().strip().split()]
output = "#" * (w+2)

for _ in range(h):
  output += "\n"
  output += "#" + stdin.readline().strip() + "#"
  
output += "\n" + "#" * (w+2)
print(output)

Submission status: Accepted

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

S.append("")
for i in range(W + 2):
    S[H  + 1] += "#"

for s in S:
    print(s)

Submission status: Accepted

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

for i in range(h):
    a[i+1].append("#")
    a[i+1].insert(0,"#")
    
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)]

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

res = ""

res += t

for a in A:
    res += "#{0}#\n".format(a)

res += t

print(res, end="")

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())
mat = [["#" for i in range(w+2)] for j in range(h+2)]
pix = []
for i in range(h):
	s = input()
	pix.append(s)
for i in range(1, h+1):
	for j in range(1, w+1):
		mat[i][j] = pix[i-1][j-1]
for i in mat:
	print("".join(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:
"""AtCoder."""


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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

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

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

Submission status: Accepted

Solution code:
# # Make IO faster
# import sys
# input = sys.stdin.readline

# # get single (or) multiple str
# X = input()

# # get single int
# N = int(input())
# # get multiple int (e.g., 2)
# X, Y = map(int, input().split())
# # get multiple int (e.g., 2) for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();

# 全部入り
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
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
import numpy as np
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()
ans = []

ans.append('#' * (W + 2))
for i in range(H):
    ans.append("#" + input() +  "#")
ans.append('#' * (W + 2))

for a in ans:
    print(a)

Submission status: Accepted

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

Ans = []

for _ in range(H):
    Ans.append('#' + input() + '#')

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

for ans in 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())
a=[list(map(str,input())) for i in range(H)]

ans=[['#' for i in range(W+2)]for j in range(H+2)]

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

Submission status: Accepted

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


for v in image:
    print(*v)

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('#'+str(i)+"#")
print('#'*(W+2))

Submission status: Accepted

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

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

Submission status: Accepted

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

for _ in range(H):
  L.append('#'+input()+'#')
else:
  L.append('#'*(W+2))

for l in L:
  print(l)

Submission status: Accepted

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

Submission status: Accepted

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


for i in range(h):
    if i==0:
        print("#"*(w+2))
    print("#"+img[i]+"#")
print("#"*(w+2))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    H, W = map(int, readline().split())
    ans = [0] * (H + 2)
    ans[0] = '#' * (W + 2)
    for i in range(1, H + 1):
        ans[i] = '#' + readline().strip() + '#'
    ans[H + 1] = '#' * (W + 2)

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

    return


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

H, W = (int(x) for x in input().split())

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

for i in range(0, H + 2):
    for j in range(0, W + 2):
        if (i == 0) | (j == 0) | (i == (H + 1)) | (j == (W + 1)):
            print("#", end='')
        elif j == 1:
            print(a[i - 1], end='')

        if j == (W + 1):
            print("")

Submission status: Accepted

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

print('#'*(w+2))
for i in range(h):
  print('#{}#'.format(p[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())
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=map(int,input().split())
print(''.join(['#'for i in range(W+2)]))
for i in range(H):print('#'+input()+'#')
print(''.join(['#'for i in range(W+2)]))