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 = [int(_) for _ in input().split()]
A = [input() for i in range(H)]

print("#" * (W + 2))
for r in A:
    print("#%s#" % r)
print("#" * (W + 2))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from sys import stderr, setrecursionlimit
from functools import reduce
from operator import add
setrecursionlimit(2147483647)
def getInt():
    return int(input())
def getInts():
    return [int(i) for i in input().split()]
def getIntLines(n=1):
    res = []
    for _ in range(n):
        res.append(getInt())
    return res
def getIntsLines(n=1):
    res = []
    for _ in range(n):
        res.append(getInts())
    return res
def debug(*x, sep=" ", end="\n"):
    for item in x:
        stderr.write(str(item))
        stderr.write(sep)
    stderr.write(end)

h, w = getInts()
ans = ['#' *(w+2)]
for _ in range(h):
    line = '#'
    line += input()
    line += '#'
    ans.append(line)
ans.append('#'*(w+2))
print(*ans, sep='\n')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
int_h, int_w = map(int,input().split())

ar_in = list()
for i in range(int_h):
    ar_in.append(list(input().split()))

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

for i in ar_in:
    print("#" + "".join(i) + "#")

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

Submission status: Accepted

Solution code:
H, W = map(int, input().split())
picture = [input() for i in range(H)]
print('#'*(W+2))
for i in range(H):
    print('#' + picture[i] + '#')
print('#'*(W+2))
#コピペです。

Submission status: Accepted

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

Submission status: Accepted

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

    for ln in a:
        print("".join(ln))


abc062_b()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
temp = input().rstrip().split(" ")
H = int(temp[0])
W = int(temp[1])
for i in range(H+2):
    if i == 0 or i == H+1:
        print("#" * (W+2))
    else:
        print("#" + str(input()) + "#")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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


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

    sharp = ""
    for _ in range(w+2):
        sharp += "#"
    print(sharp)

    for _ in range(h):
        dum = "#"
        a = str(input())
        dum += a
        dum += "#"
        print(dum)

    print(sharp)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

result = []
for a in A:
  result.append('#' + a +'#')
waku = '#' * (W+2)
result.insert(0,waku)
result.insert(len(A)+1,waku)
for r in result:
  print(r)

"""
お前の目は節穴か？
"""

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h, w = [int(i) for i in input().split()]
a = [["#" for _ in range(w+2)] for _ in range(h+2)]
print("".join(["#" for _ in range(w+2)]))
for _ in range(h):
    print("#{}#".format(input()))
print("".join(["#" for _ in range(w+2)]))

Submission status: Accepted

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

Submission status: Accepted

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

pictures.append("#" * (W+2))

for picture in pictures :
    print(picture)

Submission status: Accepted

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

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

for i in range(row):
    s = input()
    print("#" + s + "#")

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

Submission status: Accepted

Solution code:
import sys
H, W = map(int, raw_input().split())
a = [raw_input() for _ in range(H)]
for i in range(H + 2):
    for j in range(W + 2):
        if i == 0 or j == 0 or i == H + 1 or j == W + 1:
            sys.stdout.write('#')
        else:
            sys.stdout.write(str(a[i - 1][j - 1]))
    print("")

Submission status: Accepted

Solution code:

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

frame.append("#"*(w+2))
for i in frame:
  print(i)

Submission status: Accepted

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

l="#"*(W+2)

a=''
b=[]

for i in range(H):
    a="#"
    a+=input()
    a+="#"
    b.append(a)
print(l)
for i in range(H):
    print(b[i])
print(l)

Submission status: Accepted

Solution code:
# coding: utf-8
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())
#行列
s = []
str_changed = []
for i in range(h):#h:高さ
    s.append([str(m) for m in input().split()])

for i in range(h):
    str_changed.append("".join(s[i]))
for i in range(h + 2):
    if i == 0:
        print("#" * (w + 2))
    elif i == h + 1:
        print("#" * (w + 2))
    else:
        print("#" + str_changed[i - 1] + "#")

Submission status: Accepted

Solution code:
h,w=map(int,input().split())
tmp=[]
for i in range(h):
    tmp.append(input())
for i in range(h+2):
    if i==0:
        a="#"*(w+2)
        print(a)
    elif i==(h+1):
        a="#"*(w+2)
        print(a)
    else:
        print("#{}#".format(tmp[i-1]))

Submission status: Accepted

Solution code:
H, W = [int(_) for _ in 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:
a=list(map(int,input().split()))
H=a[0]
W=a[1]
line=[]
sharp=""
j=0
for i in range(W+2):
    sharp+="#"
for i in range(H):
    line.append("#"+input()+"#")
for i in range(H+2):
    if i == 0 or i == H+1:
        print(sharp)
    else:
        print(line[j])
        j+=1

Submission status: Accepted

Solution code:
H,W = (int(x) for x in input().split())
a=[input() for i in range(H)]
for i in range(W+1):
    print('#',end='')
print('#')
for i in a:
    print('#',end='')
    print(i,end='')
    print('#')
for i in range(W+1):
    print('#',end='')
print('#')

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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


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

for s in a:
		l = '#' + s + '#'
		print(l)
		
print('#' * (w+2))

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(h+2):
    if i == 0 or i == h+1:
        print("#" * (w + 2))
    else:
        print("#" + input() + "#")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

print('#%s#' % ''.join(h))
for i in A:
    print('#%s#' % i)
print('#%s#' % ''.join(h))

Submission status: Accepted

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

print('#'*(w+2))
for chrs in str_list:
    print('#'+chrs+'#')
print('#'*(w+2))

Submission status: Accepted

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

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

for i in range(H):
    print('#' + input().strip() + '#')

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

Submission status: Accepted

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

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

for i in range(H):
    print('#' + input().rstrip() + '#')

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

Submission status: Accepted

Solution code:
arr=list(map(int,input().rstrip().split()))
r=arr[0]
c=arr[1]
line=[]
for i in range(0,r):
    line.append(input())
s=[[0 for x in range(r)]for y in range(c)]
for i in range(0,r+2):
    for j in range(0,c+2):
        if i == 0 or i == r + 1 or j == 0 or j == c + 1:
            print("#",end="")
        else:
            z=line[i-1]
            print(z[j-1],end="")
    print()

Submission status: Accepted

Solution code:
#062-B
h,w=map(int,input().split())
p=[]
for i in range(h):
    t=list(input())
    p.append(t)
for i in range(w+2):
    print('#',end='')
print()

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

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

Submission status: Accepted

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

print("#"*(a[1]+2))
for i in range(a[0]):
  print("#"+b[i]+"#")  
print("#"*(a[1]+2))

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
l=[input() for _ in [0]*n]
for i,s in enumerate(l):
  l[i]='#'+s+'#'
a=['#'*(m+2)]
l=a+l+a
print('\n'.join(l))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a,b = map(int,input().split(" "))
ar = []
br = ["#" for i in range(b+2)]
ar.append(br)
for j in range(a):
    cr = list(input())
    cr.insert(0,"#")
    cr.append("#")
    ar.append(cr)
ar.append(br)
for r in ar:
    print("".join(r))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a = []
for i in range(H):
    A = input()
    A = "#" + str(A) + "#"
    a.append(A)
print(str(sharp*(W+2)))
for i in range(H):
    print(a[i])
print(str(sharp*(W+2)))

Submission status: Accepted

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

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

print('\n'.join(ans))

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in range(len(s)):
    t = list(s[i])
    t.insert(0,'#')
    t.append('#')
    s[i] = ''.join(t)


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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
h,w = map(int, input().split())
print('#'*(w+2))
for i in range(0,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:
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:
from sys import stdin


def main():
    h, w = map(int, input().split())
    a = [next_str() for _ in range(h)]

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


def next_int() -> int:
    return int(next_str())


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from sys import stdin


def main():
    h, w = map(int, input().split())
    a = [next_str() for _ in range(h)]

    ans = []
    for i in range(h + 2):
        ans += ["#"]
        if not 0 < i <= h:
            ans[i] += "#" * w
        else:
            ans[i] += a[i - 1]
        ans[i] += "#"

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


def next_int() -> int:
    return int(next_str())


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from sys import stdin


def main():
    h, w = map(int, input().split())
    a = [next_str() for _ in range(h)]
    ans = [a[i - 1] if 0 < i <= h else "#" * w for i in range(h + 2)]
    print("\n".join(map(lambda x: "#{}#".format(x), ans)))


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from sys import stdin


def main():
    h, w = map(int, input().split())
    a = [next_str() for _ in range(h)]
    ans = ["#" * w if i == 0 or i == h + 1 else a[i - 1] for i in range(h + 2)]
    print("\n".join(map(lambda x: "#{}#".format(x), ans)))


def next_int() -> int:
    return int(next_str())


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from sys import stdin


def main():
    h, w = map(int, input().split())
    a = [next_str() for _ in range(h)]

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

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


def next_int() -> int:
    return int(next_str())


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


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

for a in ans:
    print(a)

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=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(" "))
a = [input() for i in range(h)]

print("\n".join(["#" + line + "#" for line in ["#"*w] + a + ["#"*w]]))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h, w = map(int, input().split())
li=[]
index=0
while index<h:
    li.append(input())
    index+=1

print("#"*(w+2))
for sent in li:
    print("#"+ sent+"#")
print("#"*(w+2))

Submission status: Accepted

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

a = []

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

#print(a)

ans = []

for i in range(h + 2):
    if i == 0 or i == h + 1:
        s = ""
        for j in range(w + 2):
            s = s + "#"

        ans.append(s)

    else:
        s = "#" + a[i - 1] + "#"
        ans.append(s)

#print(ans)

print('\n'.join(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h,w = map(int,input().split())
li = []
for i in range(h):
    li.append("#{}#".format(input()))
print("#"*(w+2))
for j in li:
    print("".join(j))
print("#"*(w+2))

Submission status: Accepted

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

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 :
        picture = input()
        print("#"+picture+"#")

Submission status: Accepted

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

Submission status: Accepted

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

print(sh)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

h,w = li()
s = []
s.append(["#"]*(w+2))
for _ in range(h):
    temp = ["#"]
    temp = temp + lc()
    temp = temp + ["#"]
    s.append(temp)
              
s.append(["#"]*(w+2))
          
for si in s:
    print("".join(si))

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:
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 16 16:57:33 2018

@author: maezawa
"""

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

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
h,w = input().split()
h = int(h)
w = int(w)

strs = ""
tmp = []

for j in range(w + 2):
    strs += "#"
for i in range(h):
    tmp.append(input())
print(strs)
for i in range(h):
    print("#" + tmp[i] + "#")
print(strs)

Submission status: Accepted

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

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

for i in range(w+2):
    print('#', sep='', 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:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


class Combination:
    def __init__(self, n, mod):

        g1 = [1, 1]
        g2 = [1, 1]
        inverse = [0, 1]
        for i in range(2, n + 1):
            g1.append((g1[-1] * i) % mod)
            inverse.append((-inverse[mod % i] * (mod // i)) % mod)
            g2.append((g2[-1] * inverse[-1]) % mod)
        self.MOD = mod
        self.N = n
        self.g1 = g1
        self.g2 = g2
        self.inverse = inverse

    def __call__(self, n, r):
        if (r < 0 or r > n):
            return 0
        r = min(r, n - r)
        return self.g1[n] * self.g2[r] * self.g2[n - r] % self.MOD


# --------------------------------------------

dp = None


def main():
    H, W = li_input()
    S = [input() for _ in range(H)]

    print("#" * (W + 2))
    for s in S:
        print("#{}#".format(s))
    print("#" * (W + 2))


main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(a)):
    print(a[i],end='\n')

Submission status: Accepted

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

for a in ans:
    print(a)

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

Submission status: Accepted

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

Submission status: Accepted

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

a.append('#' * (W+2))
for v in a:
    print(v)