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

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

Submission status: Accepted

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

for i in a:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

h,w = map(int,input().split())

x = ['#']*(w+2)
a = [list(input()) for _ in range(h)]
for i in range(h):
    a[i].insert(0,'#')
    a[i].append('#')
a.insert(0,x)
a.append(x)
for i in range(h+2):
    print(''.join(a[i]))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
y,x = map(int, input().split())
li = []
for i in range(y):
    li.append(list(input()))
print('#'*(x+2))
for i in li:
    print('#', end = '')
    for k in i:
        print(k, end = '')
    print('#')

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

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('\n'.join(lst))

Submission status: Accepted

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

Submission status: Accepted

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

print('#'*(W+2))
for h in range(H):
    line = '#' + ''.join(A[h]) + '#'
    print(line)
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):

    a = input()
    a = "#" + a + "#"
    print (a)

print (sharp)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

H, W = map(int, input().split())
in_li = [list(input()) for i in range(H)]

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a = list(map(int,input().split()))
b = [input() for i in range(a[0])]
c = "#"*(a[1]+2)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = ["#" * (W+2)]
for i in range(H):
    tmp = "#"
    tmp += A[i]
    tmp += "#"
    ans.append(tmp)

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    for h in range(H + 2):
        if h in [0, H + 1]:
            print('#' * (W + 2))
            continue
        print('#{}#'.format(input()))

if __name__ == '__main__':
    main()

Submission status: Accepted

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



def main(h, w, a):
    ret = []
    ret.append(''.join(['#'] * (w + 2)))
    for v in a:
        r = '#' + v + '#'
        ret.append(r)
    ret.append(''.join(['#'] * (w + 2)))
    for r in ret:
        print(r)

if __name__ == '__main__':
    h, w = map(int, input().split())
    a = []
    for i in range(h):
        a.append(input())
    main(h, w, a)

Submission status: Accepted

Solution code:
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

H, W = nl()

pixels = []
for i in range(H):
    pixels.append(s())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
n,m=map(int,input().split())
a=[input() for i in range(n)]
print('#'*(m+2))
for i in range(n):
	print('#'+a[i]+'#')
print('#'*(m+2))

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


h, w = MI()
a = [IS() 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  = map(int, input().split())

lst = []
for i in range(H):
    lst += ['#' + str(input()) + '#']

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

for i in range(H):
    print (lst[i])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def abc():
    h, w = map(int, input().split())
    ans = list()
    ans.append('#'*(w+2))
    for i in range(h):
        ans.append('#' + input().rstrip() + '#')
    ans.append('#'*(w+2))
    for x in ans:
        print(x)


abc()

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())
s = "#"*(w+2)
for i in range(h+2):
  if i == 0 or i == h+1:
    print(s)
  else:
    print("#"+input()+"#")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

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

ans = np.full(np.array(A.shape) + 2, '#', dtype=str)
ans[1:-1, 1:-1] = A
print('\n'.join(map(lambda r: ''.join(r), ans)))

Submission status: Accepted

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

for i in range(h+2):
    if i == 0:
        print("#" * (w + 2))
for i in lst:
    ans = "#" + i + "#"
    print(ans)

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

Submission status: Accepted

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

Submission status: Accepted

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

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())
MAP=[input() for i in range(H)]

ANS=[["#"]*(W+2) for i in range(H+2)]

for i in range(H):
    for j in range(W):
        ANS[i+1][j+1]=MAP[i][j]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect
from operator import itemgetter
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

H,W = IL()
p = [[i for i in "#"*(W+2)] for i in range(H+2)]

for i in range(1,H+1):
  s = S()
  for j in range(W):
    p[i][j+1] = s[j]
    
for i in p:
  print("".join(i))

Submission status: Accepted

Solution code:
H, W = [int(i) for i in 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 range(H):
    print('#' + a[i] + '#')

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

Submission status: Accepted

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

print("#"*(W+2))
for i in range(H):
    print("#"+''.join(hw[i])+"#")
print("#"*(W+2))

Submission status: Accepted

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



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

a = [ "#" for _ in range(w+2)]

ls.append(a)
ls.insert(0,a)

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

Submission status: Accepted

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

h, w = map(int, input().split())

a = [['#']+list(input())+['#'] for i in range(h)]

a.insert(0, ['#']*(w+2))
a.insert(len(a), ['#']*(w+2))

for i in range(len(a)):
    print(''.join(a[i]))

Submission status: Accepted

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

Submission status: Accepted

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

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

for a in range(H):
  print('#'+input()+'#')
  
print('#'*(W+2))

Submission status: Accepted

Solution code:
H,W = map(int,input().split())
para_val = [input() for i in range(H)]
for i in range(H+2):
    if i == 0 or i== H+1 :
        a = ["#"] * (W+2)
        ans = "".join(a)
        print(ans)
    else:
        b = ["#"]
        b.append(para_val[i-1])
        b.append("#")
        ans = "".join(b)
        print(ans)

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc062/tasks/abc062_b

import itertools
import collections
import bisect

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

    print(sharp)
    for line in lines:
        print('#{}#'.format(line))

    print(sharp)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

print('#'*(W+2))
for _ in range(H):
  print('#'+''.join(list(input().split()))+'#')

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 = list(map(int, input().split()))

moji_arr = [0]*h
for i in range(h):
    moji_arr[i] = input()

sharp_arr = [0]*(h+2)

sharp_arr[0] = '#'*(w+2)
for i in range(h):
    sharp_arr[i+1] = '#' + moji_arr[i] + '#'
sharp_arr[h+1] = '#'*(w+2)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h, w = [ int(v) for v 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())
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 _ 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:
def main():
    H, W = [int(ele) for ele in input().split()]
    frame = ["#"] * (W+2)
    canvas = [[str(ele) for ele in input().split()] for _ in range(H)]

    print("".join(frame))
    for ele in canvas:
        print("#" + "".join(ele) + "#")

    print("".join(frame))


if __name__ == "__main__":
    main()

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

Submission status: Accepted

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

def solve():
    H, W = list(map(int, input().split()))

    ans = "#"*(W+2) + "\r\n"
    for h in range(H):
        ans += "#" + input() + "#\r\n"
    ans += "#"*(W+2)
    
    print(ans)

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h,w = 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("#"+"".join(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 row in a:
    print('#' + row + '#')
print('#' * (w + 2))

Submission status: Accepted

Solution code:
import sys
n, m = map(int, input().split())

s_arr = ["#" + input() + "#" for _ in range(n)]
print("#"*(m+2))
for s in s_arr:
  print(s)
print("#"*(m+2))

Submission status: Accepted

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

A_framed = ['#'*(W+2)]
for a in A:
    A_framed.append('#' + a + '#')
A_framed.append('#'*(W+2))


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

# 最上段
l=['#'*(W+2)]

for i in range(H):
  s=input()
  l.append('#'+s+'#')

# 最下段
l.append('#'*(W+2))

# 出力
for x in l:
  print(x)

Submission status: Accepted

Solution code:
#H×Wのマス目入力の周りに"."を付け加える関数
def pixel_input(H,W,border="."):
    pixel = [[border]*(W+2)] + \
    [[border] + list(input()) + [border] for _ in range(H)] + \
    [[border]*(W+2)]
    return pixel

#マス目型2次元配列を出力する関数
def pixel_print(pixel):
    for i in range(len(pixel)):
        print("".join(pixel[i]))

#数値の標準入力関数（1次元配列の場合は引数なし、2次元配列の場合は引数に行の数）
#switchを1にすると2次元配列のときに各行を配列として読み込まない
def ipt(N=0,switch=0):
    if N == 0:
        return list(map(int,input().split()))
    else:
        if switch==0:
            return [list(map(int,input().split())) for _ in range(N)]
        else:
            return [int(input()) for _ in range(N)]
          
#問題を解く
H,W=ipt()
pixel_print(pixel_input(H,W,"#"))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for w in range(W+2):
  print("#", end="")
print("")
for h in range(H):
  row = str(input())
  print("#" + row + "#")
for w in range(W+2):
  print("#", end="")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in ans:
    print(i)

Submission status: Accepted

Solution code:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(H):
    s = input()
    a[i+1] = '#' + s + '#'

for i in a:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:



H,W = map(int, input().split())
An = ['#'*(W+2)]
for _ in range(H):
  An.append('#'+str(input())+'#')
An.append('#'*(W+2))
print(*An,sep='\n')

Submission status: Accepted

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

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:
# ABC062B - Picture Frame
h, w = list(map(int, input().rstrip().split()))
lst = [input().rstrip() for _ in range(h)]
ans = ["#" * (w + 2)]

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

for i in ans:
    print(i)

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
import sys
from collections import Counter

h, w = map(int, input().split())
a_list = [input() for i in range(h)]
a_list.insert(0, '#' * w)
a_list.insert(len(a_list), '#' * w)

for i in range(len(a_list)):
    print('#' + a_list[i] + '#')

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:
#ABC062B
H, W = map(int,input().split())
a = [input() for _ in range(H)]

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

Submission status: Accepted

Solution code:

def read_input():
    h, w = map(int, input().split())

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

    return h, w, slist

def submit():
    h, w, slist = read_input()

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

if __name__ == '__main__':
    submit()

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 i in range(H)]
X = []
for i in range(H+2):
    if i == 0 or i == H + 1:
        X.append("#"*(W+2))
    else:
        X.append("#" + A[i-1] + "#")
for x in X:
    print(x)

Submission status: Accepted

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

print('#' * (W+2))
for ai in A:    
    print('#' + ai + '#')
print('#' * (W+2))

Submission status: Accepted

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

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

Submission status: Accepted

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

print("#"*(W+2))
for element in alist:
    print("#"+element+"#")
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 = []
a.append(["#"] * (W+2))
for i in range(H):
       a.append(list("#" + str(input() + "#")))
a.append(["#"] * (W+2))
for j in range(len(a)):
        print("".join(a[j]))

Submission status: Accepted

Solution code:
[H,W] = list(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("#"*(w+2))
for i in a:
    print("#{}#".format(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))
for ai in a:
    print('#{}#'.format(ai))
print('#' * (W + 2))

Submission status: Accepted

Solution code:
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n, m = f()
    s = [ input() for i in range(n)]


    for i in range(n+2):
        if i == 0 or i == n+1:
            for j in range(m+2):
                print('#', end = '')
            print()
        else:
            print('#',end = '')
            print(s[i-1], end = '')
            print('#')


solve()

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:
h, w = [int(n) for n in input().split()]

S = [['#'] * (w+2)] + [[0] * (w+2)] * h + [['#'] * (w+2)]

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

for l in S:
    print(''.join(l))

Submission status: Accepted

Solution code:
# -*- coding utf-8 -*-
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)]
A=["#"*(w+2)]+A+["#"*(w+2)]
print(*A,sep="\n")

Submission status: Accepted

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