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

Submission status: Accepted

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

for i in li:
    print(i)

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

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

print("#" * (w+2))
for i in range(h):
  s = ""
  s = "#" + A[i] + "#"
  print(s)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h,w=map(int,input().split())
a=[]
a.append("#"*(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())

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

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

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

Submission status: Accepted

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

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())
word1 = '#'*(w+2)
ans = list()
ans.append(word1)
for x in range(h):
    a = list(map(str, input().split()))
    word2 = '#' + "".join(a) + '#'
    ans.append(word2)

ans.append(word1)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    a, b = map(int, input().split())

    print("#"*(b+2))
    for i in range(a):
        s = "#"+input()+"#"
        print(s)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


X = "#"*(W+2)

#print(H,W,A)


for i in range(H):
	A[i][0] = "#" + A[i][0] +"#"

print(X)
for i in range(H):
	print(A[i][0])
print(X)

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

import sys
# import time
# import math
# import numpy as np
# import scipy.sparse.csgraph as cs            # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random                                # random, uniform, randint, randrange, shuffle, sample
# import string                                # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from datetime import date, datetime          # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj
# from datetime.datetime import strptime       # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj
# from datetime import timedelta               # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.
# from copy import copy, deepcopy              # use deepcopy to copy multi-dimentional matrix without reference
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)



def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1             # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    h, w = mi()
    grid = [input() for _ in range(h)]
    print('#'*(w+2))
    for i in range(h):
        print('#' + grid[i] + '#')
    print('#'*(w+2))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

print("".join(["#" for _ in range(w+2)]))
for j in range(h):
    s[j].insert(0,"#")
    s[j].append("#")
    print("".join(s[j]))
print("".join(["#" for _ in range(w+2)]))

Submission status: Accepted

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

a =[]

for i in range(H):
    temp = str(input())
    a.append(temp)
    

cnt =0

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

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:
        print(x*(w+2))
    else:
        print(x,a[i-1],x,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:
h, w = map(int, input().split())
tb = ['#'] * (w + 2)
print(*tb, sep='')
for i in range(h):
	print('#' + input() + '#')
print(*tb, sep='')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


h, w = LI()
a = SR(h)

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

a = []
b = [['#' for i in range (w+2)] for j in range (h+2)] #[]で囲うことが重要


for i in range(h):
    a.append(list(input())) #splitを入れなければOK

for j in range(h):
    for k in range(w):
        b[j+1][k+1] = a[j][k]
        

for l in range(h+2):
    print("".join(b[l]))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

sh = '#'

print(sh * (w+2))
[print(sh + input() + sh) for i in range(h)]
print(sh * (w+2))

Submission status: Accepted

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

a1 = ["#"]*(w+2)
x = [0]*h
for i in range(0,h):
  x[i] = input().split()

a1 = ''.join(a1)

print(a1)
for i in range(0,h):
  x[i] = ''.join(x[i])
  print("#"+x[i]+"#")
print(a1)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(H+2):
    if i == 0:
        a.insert(0, '#'*(W+2))
        print(a[i])
    elif i == H+1:
        a.append('#'*(W+2))
        print(a[i])
    else:
        a[i] = '#' + a[i] + '#'
        print(a[i])

Submission status: Accepted

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

base_word = [input() for _ in range(H)]

ans = ['#' * (W+2)]

for index, word in enumerate(base_word):
    ans.append("#{0}#".format(word))

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
H, W = map(int, input().split())
print('#' * (W + 2) )
for _ in range(H):
    print("#{}#".format(input()))
print('#' * (W + 2) )

Submission status: Accepted

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

w = "#"*(2+W)
h = []*H

for i in range(H):
    a = str("#"+input().strip()+"#")
    h.append(a)

print(w)
for j in h:
    print(j)
print(w)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
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 = [list(input()) for _ in range(h)]

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

Submission status: Accepted

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

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

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def Yes(): print("Yes"); return
def No(): print("No"); return

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
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

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def Base_10_to_n(X, n):
  if X//n:
    return Base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def Base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

H,W = inputIL()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

header = "#"*(w+2)
print(header)
for i in range(h):
    print("#"+ab[i]+"#")

print(header)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(x)
for s in S:
    print(s)
print(x)

Submission status: Accepted

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

top = "#" * (w + 2)
print(top)
for hw in hw_list:
    print("#", end="")
    print(hw, end="")
    print("#")
print(top)

Submission status: Accepted

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

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

print(end)

Submission status: Accepted

Solution code:
def invr():
    return(map(int, input().split()))


def insr():
    s = input()
    return(list(s[:len(s)]))


strs = []
a, b = invr()

for i in range(a):
    s = input()
    strs.append(s)
print("#"*(b+2))
for s in strs:
    print("#"+s+"#")
print("#"*(b+2))

Submission status: Accepted

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

print(''.join(f))

for j in range(h):
    print('#' + input() + '#')

print(''.join(f))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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())
picture = [input() for _ in range(H)]
print('#' * (W + 2))
for row in picture:
    print('#' + row + '#')
print('#' * (W + 2))

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:
N, M = map(int, input().split())
print("#"*(M+2))
for _ in range(N):
  print("#"+input()+"#")
print("#"*(M+2))

Submission status: Accepted

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

Lists = []
Lists.append([sharp])
for i in range(H):
    Lists.append(["#" + a[i] +"#"])

Lists.append([sharp])

for List in Lists:
    print(*List)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

s = '#' * (w+2)

print(s)

for _ in range(h):
    a = input()
    a = '#' + a + '#'
    print(a)

print(s)

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:
from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

h,w = mi()
a = [input() for i in range(h)]

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

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

Submission status: Accepted

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

for h in range(H):
    for w in range(W):
        ans[h+1][w+1] = pic[h][w]
        
for i in range(H+2):
    for j in range(W+2):
        print(ans[i][j], end="")
    print()

Submission status: Accepted

Solution code:
from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

h,w = mi()
a = [input() for i in range(h)]

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

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

input = sys.stdin.readline

def main():
    ans = ''
    f = '#'
    n = '\n'
    H, W = map(int, input().split())
    ans += f*(W+2)
    for _ in range(H):
        ans += n + f + input().rstrip(n) + f
    ans += n + f*(W+2)
    print(ans)

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

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:
import math
import copy

neko = 0
nuko = 0
inu = 0

h,w = map(int,input().split())
p = []
for i in range(h):
    p.append(input())
for i in range(w+1):
    print("#",end = '')
print("#")
for i in range(h):
    print('#'+ p[i] + '#')
for i in range(w+2):
    print("#",end = '')

Submission status: Accepted

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

Submission status: Accepted

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

for an in ans:
	print(an)

Submission status: Accepted

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

m = ["#"*(W+2)]

for _ in range(H):
    m.append("#"+input()+"#")

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

for i in m:
    print(i)

Submission status: Accepted

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

for i in range(-1, h + 1):
    for j in range(-1, w + 1):
        if i == -1 or j == -1 or i == h or j == w:
            print("#",end = "")
        else:
            print(a[i][j], end="")
    print()

Submission status: Accepted

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

li = ["#"*(W+2)]

for _ in range(H):
    li.append("#" + input() + "#")

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

print(*li, sep="\n")

Submission status: Accepted

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

Submission status: Accepted

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

a = []

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

for i in range(h):
    for j in range(w):
        b[i+1][j+1] = a[i][j]

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

Submission status: Accepted

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

wall = ""

# 1行目
for i in range(w + 2):
    wall += "#"
print(wall)

# 2行目から
for i in range(h):
    print("#" + str(input()) + "#")

# 最後の行
print(wall)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    b, w = map(int, input().split())
    image = [list(input()) for _ in range(b)]
    image.insert(0, ["#"]*w)
    image.append(["#"]*w)
    for im in image:
        im.insert(0, "#")
        im.append("#")

    for im in image:
        print(*im, sep="")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(len(a)):
    item = ['#']
    for j in range(len(a[i])):
        item.append(a[i][j])
    item.append('#')
    ans.append(item)
ans.append(bar)

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

Submission status: Accepted

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

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('#', A[i][0], '#', sep='')
print('#' * (w + 2))

Submission status: Accepted

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

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

for a in A:
  ans.append("#" + a + "#")
ans.append("#" * (W+2) )

for i in ans:
  print(i)