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:
#create date: 2020-04-26 08:03

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    h, w = na()
    g = ["#" * (w + 2)]
    for _ in range(h):
        g += ["#" + ns() + "#"]
    g += ["#" * (w + 2)]
    for gi in g:
        print(gi)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque
h,w = map(int,input().split())
a = deque([])
for i in range(h):
    A = deque(str(input()))
    A.appendleft("#")
    A.append("#")
    a.append(A)
a.appendleft(["#"]*(w+2))
a.append(["#"] * (w+2))
ans = []
for i in range(h+2):
    tmp = "".join(a[i])
    print(tmp)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = [['#'] * (W + 2) for _ in range(H + 2)]
for i, ai in enumerate(a):
    for j, aij in enumerate(ai):
        ans[i + 1][j + 1] = aij

for ansi in ans:
    print(''.join(ansi))

Submission status: Accepted

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

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

tmp = ['#'] * (W + 2)
lst.append(tmp)

for tmp in lst:
    print (*tmp, sep = '')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h, w = map(int, input().split())
A = [str(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:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

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


resolve()

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

args = []
for l in sys.stdin:
  args.append(l.strip('\n'))


l0 = args[0].split()
row_n = int(l0[0])
col_n = int(l0[1])

print('#' * (col_n + 2))
for i in range(row_n):
  l = '#' + args[1 + i] + '#'
  print(l)
print('#' * (col_n + 2))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def main():
  
  row, col = map(int, input().split())
  ls2 = []
  for i in range(row):
    ls = list(input().split())
    ls = ['#']+ls+['#']
    ls2.append(ls)

  ls_line = ['#']*(col+2) 
  print(''.join(ls_line))
  for row in ls2:
    print(''.join(row))
  print(''.join(ls_line))
  
if __name__ == "__main__":
  main()

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:
n,m = map(int,input().split())
A = [input() for _ in range(n)]
B = []
F = "#"*(m+2)
for i in range(n):
    B.append("#" + A[i] + "#")


print(F)
for i in range(n):
    print(B[i])
print(F)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
#cythonを使うために実行
#%load_ext Cython
#%%code
def resolve():
    H,W=map(int, input().split())
    l="#"*(W+2)
    print(l)
    for i in range(H):
        s=input()
        print("#"+s+"#")
    print(l)
#%%submit!
resolve()

Submission status: Accepted

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

for r in f:
    print(r)

Submission status: Accepted

Solution code:
H, W = map(int, input().split())
a = [input() for h 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())
s = [list(input()) for i in range(h)]
s0=['#']*(w+2)
s.insert(0,s0)
s.append(s0)
for i in range(1,h+1):
	s[i].append('#')
	s[i].insert(0,'#')
	
for ai in s:
  print("".join(ai))

Submission status: Accepted

Solution code:
h, w = map(int, input().split())
fl = "#" * (w+2)

print(fl)
for _ in range(h):
    s = "#" + input() + "#"
    print(s)
print(fl)

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

Submission status: Accepted

Solution code:
x, y = map(int,input().split())
ans = [["#"]*(y+2)]
s = []

for i in range(x):
    s = "#" + input() + "#"
    ans.append(list(s))

ans.append(["#"]*(y+2))

for a in ans:
    for b in a:
        print(b, end ="")
    print()

Submission status: Accepted

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

for i in range(-1, H+1):
    if i == -1 or i == H:
        print("#" * (W+2))
    else:
        tmp = ["#"] + a[i] + ["#"]
        print("".join(tmp))

Submission status: Accepted

Solution code:
import sys
from collections import Counter
readline = sys.stdin.buffer.readline
MOD = 10**9+7

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




if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding:utf-8
h, w = map(int, input().split())
s = [input() for _ in range(h)]

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
H,W = map(int,input().split())
# 盤面の受け取り
board = [[] for _ in range(H+2)]
board[0] = ["#"]*(W+2)
for i in range(1,H+1):
    board[i] = ["#"] + list(input()) + ["#"]
board[H+1] = ["#"]*(W+2)

for row in board:
    print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(H+2):
  if i==0 or i==H+1:
    for i in range(W+2):
      print("#",end="")
  else:
    print("#"+input()+"#",end="")
  print("")

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

al = ["#"*(w+2)]
for _ in range(h):
    al.append("#"+input()+"#")
al.append("#"*(w+2))

for a in al:
    print(a)

Submission status: Accepted

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

ans_map = [['#']*(w+2)]
for a in a_inputs:
    ans_map.append(['#']+a+['#'])
ans_map.append(['#']*(w+2))

for ans in ans_map:
    print(''.join(ans))

Submission status: Accepted

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

#配列の定義
arr = [['#' for c in range(W+2)] for r in range(H+2)]
#配列へ入力
for r in range(H):
    a=input()
    for c in range(W):
        arr[r+1][c+1]=a[c]

#取り出し
for r in range(H+2):
    for c in range(W+2):
        print(arr[r][c],end='')
    print()

Submission status: Accepted

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

Submission status: Accepted

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

while True:
  try:
    a.append(input())
  except:
    break
    
for i in range(h):
  a[i] = "#"+a[i]+"#"

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
b2 =b+2
print("#"*b2)

for i in range(a):
    c = input()
    print("#"+c+"#")

print("#"*b2)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
b2 =b+2
print("#"*b2)

for i in range(a):
    c = input()
    print("#"+c+"#")

print("#"*b2)

Submission status: Accepted

Solution code:
H, W = [int(x) for x in input().split()]
A = ['#'*(W+2)]

for i in range(H):
    A += [['#',input(),'#']]
A += ['#'*(W+2)]

for i in range(H + 2):
    print(''.join(A[i]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

list_score.insert(0, "#"*w)
list_score.append("#"*w)

for l in list_score:
    print("#"+l+"#")

Submission status: Accepted

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

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('#{}#'.format(a[i]))
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("#{}#".format(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:
n, m = list(map(int, input().split()))
s = [input() for i in range(n)]

for i in range(n+2):
  if i == 0 or i == n+1:
    print("#"*(m+2))
  
  else:
    print("#" + s[i-1] + "#")

Submission status: Accepted

Solution code:
h,w=map(int,input().rstrip().split(' '))
A = list()
a = "#"*(w+2)
A.append(a)
for i in range(h):
  a = str(input().rstrip())
  a = "#"+a+"#"
  A.append(a)

a = "#"*(w+2)
A.append(a)
for a in A:
  print(a)

Submission status: Accepted

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

Submission status: Accepted

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

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())
al = [input() for _ in [0]*h]
al = ['#'+a+'#' for a in al]
sharp = '#'*(w+2)
print(sharp)
print('\n'.join(al))
print(sharp)

Submission status: Accepted

Solution code:

n,m=map(int,input().split())
# print
# v=[]
for i in range(n+2):
    s=""
    if i==0 or i==n+1:
        s="#"*(m+2)
        
    else:
        a=input()
        s="#"+a+"#"
    print(s)
    # v.append(s)
    
    
# for i in v:
#     print(i)

Submission status: Accepted

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

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

Submission status: Accepted

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

pic = []

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


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

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


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

Submission status: Accepted

Solution code:
# solution

n,m=map(int,input().split())
print("#"*(m+2))

for i in range(n):
    print("#"+input()+"#")
print("#"*(m+2))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for aw in aaa:
    print(''.join(aw))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

def myAnswer(H:int,W:int,A:list)-> None:
   for h in range(H+2):
      if(h == 0 or h == H+1):
         print("#"*(W+2))
      else:
         for w in range(W+2):
            if(w == 0):
               print("#",end="")
            elif(w == W+1):
               print("#")
            else:
               print(A[h-1][w-1],end="")


def modelAnswer():
   tmp=1
def main():
   H,W =map(int,input().split())
   A = []
   for i in range(H):
      A.append(list(input()))
   myAnswer(H,W,A)

if __name__ == '__main__':
   main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

print(l)
for i in range(h):
    tmp = input()
    print("#"+tmp+"#")
print(l)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math

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

Submission status: Accepted

Solution code:
def main():
    H, W = map(int, input().split())
    img = [input().split() for _ in range(H)]
    new_img = list()
    
    print("#" * (W + 2))
    for l in img:
        print("#" + "".join(l) + "#")
    print("#" * (W + 2))
main()

Submission status: Accepted

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

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

a = []
for i in range(h):
    a += [input()]

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

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

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

Submission status: Accepted

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

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

print(*ue,sep="")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h,w = map(int,input().split(' '))
ans = '#'*(w+2) + '\n'
i = 0
while i < h:
    ans += '#'
    ans += input()
    ans += '#\n'
    i += 1
ans += '#'*(w+2) + '\n'
print(ans)

Submission status: Accepted

Solution code:
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt
from functools import lru_cache, reduce
INF = 1 << 60
mod = 1000000007
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# ここから書き始める
h, w = map(int, input().split())
a = [[] for i in range(h)]
for i in range(h):
    a[i] = input().split()
for i in range(w + 2):
    print("#", end="")
print()
for i in range(h):
    print("#", end="")
    print(*a[i], end="")
    print("#")
for i in range(w + 2):
    print("#", end="")
print()

Submission status: Accepted

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

Submission status: Accepted

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

grid = [['#'] * (W + 2) for _ in range(H + 2)]
for i in range(H + 2):
    for j in range(W + 2):
        if 1 <= i <= H and 1 <= j <= W:
            grid[i][j] = A[i - 1][j - 1]

for i in range(H + 2):
    print(*grid[i], sep='')

Submission status: Accepted

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
h,w=iim()
p = []
for i in range(h):
    p.append(input())

print('#'*(w+2))
for i in p:
    print('#'+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())
s = [input() for i in range(h)]

mark = '#'
print(mark * (w+2))
for string in s:
    print('#' + string + '#')
print(mark * (w+2))

Submission status: Accepted

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

for i in range(h):
    a.append(input())
    
print("#"*(w+2))
for i in a:
    print("#"+i+"#")


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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(a)):
    a[i]='#'+a[i]+'#'
a.insert(0, '#'*(w+2))
a.append('#'*(w+2))

for s in a:
    print(s)

Submission status: Accepted

Solution code:
import math
h, w = list(map(int, input().split()))
o = ''
f = w + 2
o = o + (f*'#'+'\n')
for i in range(h):
    v = input()
    vl = len(v)
    a = math.floor((f - vl) / 2)
    o = o + ((a*'#')+v+(a*'#')+'\n')
o = o + (f*'#')
print(o)

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:
_,w,*s=open(0).read().split()
t,k="#"*-~int(w),"#\n#"
print(t,*s,sep=k,end=k+t)

Submission status: Accepted

Solution code:
_, w, *s = open(0).read().split()
t, k = "#"*-~int(w), "#\n#"
print(t, *s, sep=k, end=k+t)

Submission status: Accepted

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

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

for i in range(1, H+1):
    row = list(input())
    for j in range(1, W+1):
        matrix[i][j] = row[j-1]

for row in matrix:
    print("".join(row))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h, w = map(int, input().split())
x = '#'
y = x*(w+2)

a = list(x+input()+x for _ in range(h))
a.insert(0,y)
a.append(y)
print('\n'.join(a))

Submission status: Accepted

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

a = []

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

ans = []

for i in range(H+2):
    if (i ==0) | (i==H+1):
        add_st = '#'*(W+2)
    else:
        add_st = '#' + str(a[i-1][0]) + '#'
        
        
    ans.append(add_st)

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

Submission status: Accepted

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

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

ans = []

for i in range(H):
    ans_ = input()
    ans.append(ans_)

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

for t in ans:
    ans_t = '#' + t + '#'
    print(ans_t)

print(ans_t_)