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:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

li=[]

for i in range(h):
    li.append(list(input()))

for i in range(len(li)):
    li[i].insert(0,'#')
    li[i].append('#')

li.append(['#' for i in range(w+2)])
li.insert(0,['#' for i in range(w+2)])

for i in range(len(li)):
    print("".join(li[i]))

Submission status: Accepted

Solution code:
h, w = map(int, input().split())
list = []
for x in range(h):
    str = input()
    list.append(str)
for id in range(h + 2):
    if id == 0 or id == h + 1: print('#' * (w + 2))
    else: print('#' + list[id - 1] + '#')

Submission status: Accepted

Solution code:
def sharpimage(h , w , a):

    reans = []
    aa = ""

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

 #   for i in range(h):
    for i in a:
        reans.append("#" + i + "#")

    reans.insert(0 , aa)
    reans.append(aa)

    return reans

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

    ans = sharpimage(h , w , a)
    for i in range(len(ans)):
        print(ans[i])

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
h,w=map(int,input().split())
a = [input() for i in range(h)]
b=[]
e=""
for x in range(w+2):
    e+="#"
b.append(e)
for x in a:b.append("#"+x+"#")
b.append(e)
print("\n".join(b))

Submission status: Accepted

Solution code:
c, r = tuple(map(int, input().split()))
print('#'*(r+2))
for _ in range(c):
    print('#{}#'.format(input()))
print('#'*(r+2))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print('#'*(W+2))
for i in range(H):
    s = input()
    print("#{}#".format(s))
print('#'*(W+2))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
h,w = map(int,input().split())
print("#"*(w+2))
for i in range(h):
    print("#",end="")
    print(input(),end="")
    print("#")
print("#"*(w+2))

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 30, Jan, 2020
"""

import sys

# import itertools
# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

H, W = map(int, readline().split())
a = read().decode('utf8').split()
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())
graph = [input() for _ in range(H)]
print("#" * (W + 2))
for i in graph:
    print("#" + 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
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

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()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

H, W = MAP()

a = ["#"*(W+2)] + ["#"+input()+"#" for _ in range(H)] + ["#"*(W+2)]
print(*["".join(x) for x in a], sep="\n")

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

def puts(n:int, s:str) -> None:
    for _ in range(n):
        print(s, end='')

        
puts(w+2, "#")
print("\n", end='')

for i in range(h):
    print("#", end='')
    print(''.join(a[i]), end='')
    print("#")
puts(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):
    print("#", end="")
    t = input()
    print(t, end="")
    print("#")
print(s)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    H, W = MAP()
    A = [input() for i in range(H)]
    ans = ["#" * (W + 2)] + ["#" + A[i] + "#" for i in range(H)] + ["#" * (W + 2)]
    print(*ans, sep="\n")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
r = '##'
for i in range(M):
    r += '#'
print(r)
for i in range(N):
    s = input()
    t = '#' + s + '#'
    print(t)
print(r)

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    h,w=INTM()
    ans=['#'*(w+2)]
    
    for i in range(h):
        temp=STR()
        temp='#'+temp+'#'
        #print(ans)
        ans.append(temp)
    ans.append(['#'*(w+2)])
    for i in range(h+2):
        print(*ans[i],sep='')
if __name__ == '__main__':
    do()

Submission status: Accepted

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

print('#'*(w+2))
for i in l:
    print('#'+i+'#')
print('#'*(w+2))

Submission status: Accepted

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

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

for i in a:
  ans += "#"
  ans += i
  ans += "#"
  ans += "\n"

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

print(ans)

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_list:
    print('#' + a + '#')

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#from fractions import gcd
#mod = 10 ** 9 + 7
#N = int(input())
#a = list(map(int,input().split()))
#a,b,c = map(int,input().split())
#ans = [0] * N

H,W = map(int,input().split())
word = []
for i in range(H):
    word.append('#'+input()+'#')

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

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

Submission status: Accepted

Solution code:
H,W = [int(i) for i in input().split()]
nes = [0] * H
for i in range(H) :
    li = list(input())
    nes[i] = li
lia = ["#"] * (W+2)
nes.append(lia)
nes.insert(0,lia)
for i in range(1,H+1) :
    nes[i].append("#")
    nes[i].insert(0,"#")
for i in range(H+2) :
    k = ''.join(nes[i])
    print(k)

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())
awh = [input() for _ in range(h)]

ans = ""

ans += ("#"*w + "#" + "#" + "\n")

for i in awh:
	ans += "#" + i + "#" + "\n"

ans += ("#"*w + "#" + "#" + "\n")

print(ans)

Submission status: Accepted

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

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

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):
  if i == 0 or i == H + 1:
    ans.append("#" * (W + 2))
  else:
    ans.append("#" + a[i - 1] + "#")

for j in ans:
  print(j)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

for i in range(h):
  print("#",end="")
  print(sList[i],end="")
  print("#")

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

Submission status: Accepted

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

l = []

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

  
# 端の#を作成
el = ''

for i in range(w+2):
  el += '#'
  
  
# すでにある行ごとに#を足していく作業
for i in range(h):
  l[i] = ("#"+ l[i] + "#")

  
# 端の#をlに足し合わせる
l.insert(0, el)
l.append(el)


# 行ずつに分けて表示
for i in range(len(l)):
  print(l[i])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y = map(int,input().split())

a = list()
a.append("#"*(y+2))
for i in range(x):
    a.append(input())

for i in range(1,x+1):
    a[i] = "#"+a[i]+"#"

a.append("#"*(y+2))


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

Submission status: Accepted

Solution code:
x, y = map(int, input().split())

print('#'*(y+2))
for i in range(x):
    print('#'+input()+'#')
print('#'*(y+2))

Submission status: Accepted

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

tmp = ['#' * (W+2)]
ans = tmp + areas + tmp
for a in ans:
    print(a)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
h,w=map(int,input().split())
a=[list(map(str,input().split())) for _ in range(h)]
ans=[["#"]*(w+2)]
for i in range(h):
    b=["#"]
    b+=a[i]
    b+=["#"]
    ans.append(b)
ans.append(["#"]*(w+2))
for i in ans:
    print("".join(i))

Submission status: Accepted

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

H_output = H+2
W_output = W+2

S = []
for _ in range(H):
    s = list(input())
    S.append(s)
count = 0

for i in range(H_output):
    if i==0 or i==H+1:
        row = ["#"]*(W+2)
        print(*row,sep="")
        continue
    else:
        row_left = ["#"]*1
        row_right = ["#"]*1
        row = row_left + S[count] + row_right
        print(*row,sep="")
        count = count + 1

Submission status: Accepted

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

x = "#" * w + 2 * "#"
print(x)
for _ in range(h):
    print("#" + input() + "#")
print(x)

Submission status: Accepted

Solution code:


import numpy as np
import fractions as fra


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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
pic=[]

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

for i in range(b+2):
  print("#",end="")
print()
for i in range(a):
  print("#",end="")
  print(pic[i],end="")
  print("#")
  
for i in range(b+2):
  print("#",end="")

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
H, W = [int(x) for x in input().split()]
a = []
for _ in range(H):
    a.append(input().rstrip())
ans = []
ans.append("#" * (W + 2))
for i in a:
    i = "#" + i + "#"
    ans.append(i)
ans.append("#" * (W + 2))
for j in ans:
    print(j)

Submission status: Accepted

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

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

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

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

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

Submission status: Accepted

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

ah , aw = h + 2, w + 2

answer = ["#" * (aw)]
for _ in range(h):
    answer += ["#" + input() + "#"]
answer += ["#" * (aw)]

for i in answer:
    print(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 = map(int, input().split())
a = [list(input()) for _ in range(h)]
for i in range(h+2):
    ans = ""
    for j in range(w+2):
        if i == 0 or i == h+1 or j == 0 or j == w+1:
            ans += "#"
        else:
            ans += a[i-1][j-1]
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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())
mylist=[]
for i in range(H):
    var = input()
    mylist.append(var)
print("#"*(W+2))
for i in range(H):
    print ("#"+mylist[i]+"#")
print("#"*(W+2))

Submission status: Accepted

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

for i in range(h):
    c = ['#', a[i], '#']
    lst.append(''.join(c))

lst.append(b)

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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


for i in range(-1,h+1):
    if i == -1 or i == h:
        print(*['#'] * (w+2),sep='')
    else:
        print('#'+pic[i]+'#')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
H, W = map(int, input().split())
#N = int(input())
#S = str(input())

Q = []
for _ in range(H) :
  Q.append(str(input()))
#print (Q)

s = "##"
for _ in range(W) :
  s += "#"

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

Submission status: Accepted

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

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

print("#"*(m+2))
for i in range(n):
  print("#"+s[i]+"#")
print("#"*(m+2))

Submission status: Accepted

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

print("#"*(m+2))
for i in range(n):
  print("#"+s[i]+"#")
print("#"*(m+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 a in A:
	print(a)
print('#'*(W+2))

Submission status: Accepted

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

Submission status: Accepted

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

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 = list(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))
print(*['#'+input()+'#' for _ in range(h)], sep='\n')
print('#'*(w+2))

Submission status: Accepted

Solution code:
import sys
h,w = map(int, sys.stdin.readline().split())

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
ans = 0 ;count = 0 ;pro = 1

h,w=map(int,input().split())
data=[list(input()) for i in range(h)]
ans=[["#"]*(w+2) for i in range(h+2)]
for i in range(1,h+1):
    ans[i][1:w+1]=data[i-1]
for ai in ans:
    print(*ai,sep="")

Submission status: Accepted

Solution code:
import sys

h, w = map(int, sys.stdin.readline().split())
canvas = ['#' * (w + 2)] + ['#' + sys.stdin.readline().rstrip() + '#' for _ in range(h)] + ['#' * (w + 2)]

def main():
    return canvas

if __name__ == '__main__':
    ans = main()
    print(*ans, sep='\n')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
y,x=map(int,input().split())
info=[]
for i in range(y):
    a=list(input())
    a.insert(0,"#")
    a.append("#")
    info.append(a)
b=["#"]*(x+2)
info.insert(0,b)
info.append(b)
for i in range(y+2):
    print("".join(info[i]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print("#" * (W + 2))
for _ in range(H):
    s = input()
    print("#{}#".format(s))
print("#" * (W + 2))

Submission status: Accepted

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

Submission status: Accepted

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

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())
S=["#"+input()+"#" for i in range(h)]
S=["#"*(w+2)]+S+["#"*(w+2)]
print(*S, sep="\n")

Submission status: Accepted

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

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

for i in range(H):
    s = str(input())
    s = ["#",s,"#"]
    print(''.join(map(str,s)))
for i in range(W+2):
    print("#",end="")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

top = "#" * len(ls_a[0])
bottom = "#" * len(ls_a[0])


print(top)
for j in range(h):
    print(ls_a[j])
print(bottom)

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] + "#")
print ("#"*(w+2))

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(1,H+1):
    a[i]=list(a[i])
    a[i].insert(0,'#')
    a[i].append('#')
    a[i]=''.join(a[i])

a='\n'.join(a)

print(a)

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())
lst = ['#' * (w + 2)]
for _ in range(h):
    lst.append('#' + input() + '#')
lst.append('#' * (w + 2))
print(*lst, sep='\n')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
H, W = map(int, input().split())
a = []
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:
#テストファイルで実行する時
import sys
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')

h,w = map(int,input().split())
s = [str('#'+input())+'#' for i in range(h)]

test = ''
for i in range(w+2):
	test = test + '#' 

#リストsの頭にtestを追加
s.insert( 0,test)

#リストsの最後にtestを追加
s.insert(len(s),test)

for i in range(h+2):
	print(''.join(s[i]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    h,w=MI()
    ss=[input() for _ in range(h)]
    print("#"*(w+2))
    for s in ss:
        print("#"+s+"#")
    print("#" * (w + 2))
main()

Submission status: Accepted

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

Submission status: Accepted

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

print("#"*(w+2))
for i in range(len(c)):
    a = list(c[i])
    a.insert(0,"#")
    a.append("#")
    b = "".join(a)
    print(b)
    
print("#"*(w+2))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
##### 解けた #####

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

print("#"*(W+2)) # 一番上の行

# 入力を受け取って、両端に"#"をつけて出力する
for _ in range(H):
    print("#"+input()+"#")

print("#"*(W+2)) # 一番下の行

Submission status: Accepted

Solution code:
from sys import stdin
from itertools import accumulate

h,w = [int(x) for x in stdin.readline().rstrip().split()]
li = [["" for i in range(w)]for j in range(h)]

for i in range(h):
    s = stdin.readline().rstrip()
    for j in range(w):
        li[i][j] = s[j]

lin = [["#" for i in range(w+2)]for j in range(h+2)]

for i in range(h):
    for j in range(w):
        lin[i+1][j+1] = li[i][j]

for i in lin:
    print("".join(i))

Submission status: Accepted

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

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

Submission status: Accepted

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

A = [[str(input())] for _ in range(h)]

for i in range(h):
    A[i].insert(0, '#')
    A[i].append('#')

A.insert(0, ['#'*(w+2)])
A.append(['#'*(w+2)])

for j in range(h+2):
    print(''.join(A[j]))

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
H,W = (int(i) for i in input().split())
Y = []
for i in range(W+2):
    Y.append('#')
    
Z = [Y]
for i in range(H):
    tmp = str(input())
    X = ['#']
    X.append(tmp)
    X.append('#')
    Z.append(X)

Z.append(Y)
for i in range(H + 2):
    print(''.join(Z[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 = map(int, input().split())
l = [input() for _ in range(H)]
print('#'*(W+2))

for i in l:
    print('#'+i+'#')

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

Submission status: Accepted

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

# print(a)

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

area = []

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

for i in range(h+2):
    if i == 0:
        print('#'*(w+2))
    elif i == h+1:
        print('#'*(w+2))
    else:
        print('#'+area[i-1]+'#')

Submission status: Accepted

Solution code:
h,w = map(int,input().split())
A = [list(input()) for i in range(h)]
B = [['']*(w+2)]*(h+2)
for i in range(h+2):
    for j in range(w+2):
        if i==0 or i==h+1:
            B[i][j]='#'
        elif j == 0 or j == w+1:
            B[i][j]='#'
        else:
            B[i][j]=A[i-1][j-1]
    print(*B[i],sep='')

Submission status: Accepted

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

for i in range(h):
    s[i]=['#']+s[i]+['#']
s=[l]+s+[l]

for i in range(h+2):
    s[i]=''.join(s[i])
    
print(*s,sep='\n')