Problem:


Score : 200 points

Problem Statement

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

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

Constraints

1 ≤ H, W ≤ 100

a_{ij} is a lowercase English letter.

Input

Input is given from Standard Input in the following format:

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

Output

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

Sample Input 1

2 3
abc
arc

Sample Output 1

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

Sample Input 2

1 1
z

Sample Output 2

###
#z#
###



Sample input:
2 3
abc
arc


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h, w = [int(_) for _ in 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 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 i in a:
    print('#'+i+'#')
print('#'*(w+2))

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(h+2):
    k=ab[i]
    print(''.join(map(str,k)))

Submission status: Accepted

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

ans = []
ans.append(['#'*(W+2)])
for row in a:
    row.insert(0, '#')
    row.append('#')
    ans.append(row)
ans.append(['#'*(W+2)])
for i in range(H+2):
    print(*ans[i], sep='')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

tmp = ["#"+input()+"#" for i in range(h)]

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

for i in tmp:
    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())
s = ["#"]
a = [s + list(input()) + s for _ in range(h)]
s = ["#"] * (w + 2)
print("".join(s))
for b in a:
    print("".join(b))
print("".join(s))

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):
    s=input()
    print("#",s,"#",sep="")
for i in range(w+1):
    print("#",end="")
print("#")

Submission status: Accepted

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

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

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:
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:
H, W = map(int, input().split())
list = []

for i in range(H):
  line = input()
  list.append(line)
  
print('#' * (W+2))

for i in range(H):
  print('#' + list[i] + '#')

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

grid = []
for i in range(H + 2):
        grid.append(strings[i].center(W+2,'#'))

for row in grid:
    print(row)

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

print("".join(["#"]*(W+2)))
for h in range(H):
  print("".join( ["#"] + list(input()) + ["#"]))
print("".join(["#"]*(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:
#ABC062.B
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):
	print('#'+input()+'#')
print('#'*(w+2))

Submission status: Accepted

Solution code:
# Author: cr4zjh0bp
# Created: Mon Mar 23 19:34:20 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

h, w = na()
a = nsn(h)

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in a:
    print(''.join(i))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
# fractions.gcd() を用いること
# math.log2()はatcoderでは対応していない．留意せよ．

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


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


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def main():
    h,w = map(int,input().strip().split())
    ll=["#" * (w+2)]
    
    for _ in range(h):
        ll.append("#"+input().strip()+"#")
    ll.append("#" * (w+2))
    for s in ll:
        print(s)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

aaa = [["#"] * (w+2)]
aaa.extend(ans)
aaa.append(["#"] * (w+2))

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(1,H+1):
    S[i][1:-1]=list(input())
    
for s in S:
    s = map(str, s)
    print("".join(s))

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(h):
    print("#{}#".format(input()))

print(st)

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:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():
    H,W=map(int,input().split())
    A=[str(input()) for i in range(H)]

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

resolve()

Submission status: Accepted

Solution code:
# import sys
# import math
# import decimal
# import queue
# import bisect
# import heapq
# import time
# import itertools
# import collections # queue
# from fractions import Fraction

mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

def main():
    h,w = map(int,input().split())
    a = []
    a.append(['#'] * (w + 2))
    for i in range(h):
        x = list(input())
        x.insert(0,'#')
        x.append('#')
        a.append(x)
    a.append(['#'] * (w + 2))
    for i in range(len(a)):
        print(''.join(a[i]))
    return

if __name__=='__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7


H, W = MI()
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):
    a[i].insert(0,'#')
    a[i].append('#')
wall = ['#' for _ in range(w+2)]
a.insert(0, wall)
a.append(wall)
for i in a:
    print(*i, sep='')

Submission status: Accepted

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


def main():
    H, W = [int(x) for x in input().split()]
    print("#" * (W + 2))
    for _ in range(H):
        print("#" + input() + "#")
    print("#" * (W + 2))
    pass


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n+2):
            if i==0 or i==n+1:
                        c=['#']*(m+2)
                        d="".join(c)
                        print(d)        
            else:
                        #print('i',i)
                        e=['#']+a_all[i-1]+['#']
                        f="".join(e)
                        print(f)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

H=""
for j in range(w+2):
  H+="#"

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

Submission status: Accepted

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

Submission status: Accepted

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

#a = [list(input().split()) for _ in range(h)]

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

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

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:


def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    H,W=MI()
    a=[[] for _ in range(H+2)]
    a[0]="#"*(W+2)
    for i in range(H):
        a[i+1]="#"+input()+"#"
        
    a[-1]="#"*(W+2)
    
    for i in range(H+2):
        print(a[i])

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
h, w = map(int,input().split())
a = []
for i in range(h):
    a.append(list(input()))
#print(a)

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

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

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

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:
# -*- coding: utf-8 -*-

H,W = list(map(int, input().rstrip().split()))
a_list = [list(input().strip()) for _ in range(H)]
#-----

b_list=[ ["#" for c in range(W+2)] for r in range(H+2) ]

for i in range(H):
    for j in range(W):
        b_list[i+1][j+1] = a_list[i][j]

for li in b_list:
    print(*li,sep="")

Submission status: Accepted

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

H,W = list(map(int, input().rstrip().split()))
a_list = [input().strip() for _ in range(H)]
#-----

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

x=[]

#最初の行追加
first =[]
for i in range(w+2):
  first.append("#")
  
#for文で回す

for i in range(h):
  a[i].append("#")
  
  for j in range(w):
    a[i].append(a[i][j])
    
  a[i].append("#")
  del a[i][:w]

#最後の行追加
last=[]
for i in range(w+2):
  last.append("#")

print("".join(first))
for k in range(h):
  print("".join(a[k][:]))

print("".join(last))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#ABC062

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

Ans = []
for i in range(H+2) :
    Ansi = ["#" for x in range(W+2)]
    if i != 0 and i != H+1 :
        for j in range(W) :
            Ansi[j+1] = S[i-1][j]
    Ans.append(Ansi)

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

Submission status: Accepted

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

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

for j in range(h+2):
    print(l[j])

Submission status: Accepted

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

for i in range(1,h+1):
    x = list(l.pop(i))
    x.insert(0,'#')
    x.append('#')
    l.insert(i,''.join(x))

for j in range(h+2):
    print(l[j])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    height, width = map(int, input().split())
    image = ["#" * (width+ 2)] * (height + 2)
    for i in range(1, height + 1):
        image[i] = "#" + input() + "#"
    for i in range(height + 2):
        print(image[i])


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())
W = W + 2
print('#'*W)
for i in range(H):
  print('#'+ input().rstrip() + '#')
print('#'*W)

Submission status: Accepted

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

Submission status: Accepted

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

a=[]
a.append(["#" for i in range(2+w)])
for i in range(h):
    a.append(["#"]+list(input())+["#"])
a.append(["#" for i in range(2+w)])

for i in range(h+2):
    for j in range(w+2):
        print(a[i][j],end="")
    print()

Submission status: Accepted

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

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

for i in range(a+2):
    if i == 0:
        print("#" * (b+2))
    elif i != 0 and i != a+1:
        print("#" + "".join(A[i-1]) + "#")
    elif i == a+1:
        print("#" * (b+2))

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
#壁あり迷路
H,W = map(int,readline().split())
H += 2; W += 2
maze = [["#"]*W]
for _ in range(H-2):
    maze += [list('#' +readline().rstrip().decode() + '#')]
maze += [["#"]*W]
#バグる場合はdecode("utf-8")にすること

for i in maze:
    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:
H, W = map(int, input().split())
X = []
for _ in range(H):
    X.append(input())

print("#" * (W + 2))
for x in X:
    print("#", x, "#", sep="")    
print("#"*(W+2))

Submission status: Accepted

Solution code:
# coding: utf-8
h,w=map(int,input().split())
A=[]
for i in range(h):
    a=input()
    a='#'+a+'#'
    A.append(a)
s='#'*(w+2)
A.insert(0,s)
A.append(s)

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

Submission status: Accepted

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

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

for i in range(h):
    c = input()
    s[i+1][1:w+1] = c

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

Submission status: Accepted

Solution code:
H, W = map(int, input().split())
mark_list = [["#"]*(W+2) for i in range(H+2)]
for i in range(1,H+1):
  w_list = input()
  for j in range(1,W+1):
    mark_list[i][j] = w_list[j-1]

# output
for i in mark_list[0]:
  print(i, end="")
print("")
for i in range(1,H+1):
  for j in range(W+2):
    print(mark_list[i][j], end="")
  print("")
for i in mark_list[H+1]:
  print(i, end="")

Submission status: Accepted

Solution code:
h, w = map(int, input().split())
grid = [input() for _ in range(h)]
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())
 
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())
li = [input() for i in range(H)]
buf = ""
for h in range(H) :
    if h == 0 :
        for w in range(W + 2) :
            buf += "#" 
        print(buf)
    print("#" + li[h] + "#")
    if h == H - 1 :
        print(buf)

Submission status: Accepted

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

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 _ 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())
l =[[] for i in range(h+2)]
l[0] = "#"*(w+2)
for i in range(h):
  l[i+1] = "#"+input()+"#"
l[-1] = "#"*(w+2)

for i in l:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
h,w = map(int,input().split())
f = lambda x:print('#'*x)
f(w+2)
for _ in range(h):
  print('#'+input()+'#')
f(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())

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

Submission status: Accepted

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

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

Submission status: Accepted

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

h,w=map(int,input().split())
s=["#"*(w+2),]

for i in range(h):
    t=input()
    s.append("#{}#".format(t))

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

Submission status: Accepted

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

print("#"*(w+2))
for i in range(h):
    t = "".join(["#"]+a[i]+["#"])
    print(t)
print("#"*(w+2))

Submission status: Accepted

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

print('#' * (W + 2))
for i in range(H):
    print('#%s#' % (input()))
print('#' * (W + 2))

Submission status: Accepted

Solution code:
import numpy as np
H,W=map(int,input().split())
a=[list(map(str,list(input()))) for i in range(H)]
f=np.empty((H+2,W+2))
f=f.tolist()
#print(f)
#print(a)

for i in range(H+2):
    for j in range(W+2):
        if (i==0)or(i==H+1)or(j==0)or(j==W+1):
            f[i][j]='#'
            #print("#")
        elif (i>0)and(j>0):
            f[i][j]=a[i-1][j-1]
            #print(a[i-1][j-1])
for i in f:print(*i, sep='')

Submission status: Accepted

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

Submission status: Accepted

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

first_end = ["#" for _ in range(w+2)]
hw.append(first_end)

for _ in range(h):
    one_line = list(input())
    one_line.insert(0, "#")
    one_line.append("#")
    hw.append(one_line)

hw.append(first_end)

for one_line in hw:
    print("".join(one_line))

Submission status: Accepted

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

ans = []
S=""
for i in range(W+2):
    S=S+"#"
ans.append(S)
for i in range(H):
    s = "#"
    for j in range(W):
        s = s+a[i][j]
    s = s+"#"
    ans.append(s)
ans.append(S)
for i in range(len(ans)):
    print(ans[i])

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

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