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:
import sys
import copy
import  math
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

h, w = na()
s = "#" * (w + 2)
img = [s]
for _ in range(h):
    img.append("#" + input() + "#")
img.append(s)
for i in range(h+2):
    print(img[i])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a = "".join(["#"] * (w + 2))

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

print(a)

Submission status: Accepted

Solution code:
# ABC062b
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

h, w = map(int, input().split())
a = [input().replace('\n', '') for _ in range(h)]

print('#' * (w + 2))
for line in a:
    print('#', end='')
    print(line, end='')
    print('#')
print('#' * (w + 2))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:


def main():
    a,b = map(int,input().split())
    pictureList = [ input() for _ in range(a)]
    row = b+2

    print(row*'#')
    for i in pictureList:
        print('#'+i+'#')
    print(row*'#')
    


if __name__== "__main__":
    main()

Submission status: Accepted

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

for a in A:
  print(*a,sep='')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

for x in a:
    print(x)

Submission status: Accepted

Solution code:
a,b = [int(i) for i in input().split()]
l = [input() for i in range(a)]
for i in range(a+2):
    if i == 0 or i == a+1:
        print('#'*(b+2))
    else:
        print('#{}#'.format(l[i-1]))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h, w = map(int, input().split())
S = [input() for i 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())
a = [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 or j == 0 or j == w+1:
            print("#",end="")
        else:
            print(a[i-1][j-1],end="")
    print()

Submission status: Accepted

Solution code:
y,x = map(int,input().split())
str = [["#" for i in range(x+2)]for i in range(y+2)]
a = [0 for i in range(y)]
for i in range(y):
    a[i] = input()
for i in range(1,y+1):
    for z in range(1,x+1):
        check = a[i-1]
        str[i][z] = a[i-1][z-1]

for i in range(y+2):
    print("".join(str[i]))

Submission status: Accepted

Solution code:
h,w = map(int,input().split())
l = [[] for i in range(h+2)]
l[0] = ["#"]*(w+2)
for i in range(h):
    a = list(input())
    a.append("#")
    a.reverse()
    a.append("#")
    a.reverse()
    l[i+1] = a
l[h+1] = ["#"]*(w+2)
for i in range(h+2):
    if i != 0:
        print()
    for x in l[i]:
        print(x,end="")

Submission status: Accepted

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

print('#' * (b + 2))
for i in range(a):
    print('#' + input() + '#')
print('#' * (b + 2))

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(H + 2):
    if i == 0 or i == H + 1:
        print("".join(a[i]))
    else:
        a[i][1:W + 1] = input().split()
        print("".join(a[i]))

Submission status: Accepted

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

for i in range(H):
    a[i + 1][1:W + 1] = input().split()

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

Submission status: Accepted

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

for i in range(W + 1):
    a[0] += "#"
    a[H + 1] += "#"

for i in range(1, H + 1):
    a[i] += "".join(input().split()) + "#"

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

ans=[["0" for _ in range(w+2)] for _ in range(h+2)]
for i in range(w+2):
    ans[0][i]="#"
    ans[h+1][i]="#"
    
for i in range(w):
    for j in range(h):
        ans[j+1][i+1]=a[j][i]
        
for i in range(h):
    ans[i+1][0]="#"
    ans[i+1][w+1]="#"
for i in range(h+2):
    print(''.join(ans[i]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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

    A = input()
    print(A, end='')

    print('#')

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

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())
pic=[["#" for i in range(w+2)]]
for i in range(h):
  s=list(input())
  s=["#"]+s+["#"]
  pic.append(s)
pic.append(["#" for i in range(w+2)])

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
h,w=map(int,input().split())
print('#'*(w+2))
for j 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):
    s.append("#"+input()+"#")
s.append("#"*(w+2))
print(*s,sep="\n")

Submission status: Accepted

Solution code:
import math
import sys
from itertools import accumulate
from functools import reduce
import queue
from fractions import gcd

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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

sys.setrecursionlimit(10000)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())
    = [list(list(sys.stdin.readline().rstrip())) for i in range(h)] #文字列を分解して二次元配列入力

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき
"""

if __name__ == "__main__":
    h,w= map(int, sys.stdin.readline().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().split()+['#'])
ans1 = ['#'] * (w+2)
print(''.join(ans1))
for i in range(h):
    print(''.join(a[i]))
print(''.join(ans1))

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(h+2):
  if i == 0 or i == h+1:
    sharps = ["#"]*(w+2)
    print("".join(sharps))
  else:
    s = input()
    print("#"+s+"#")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in a:
    print(i)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

temp=["#" for _ in range(b+2)]
mass = []
mass.append(temp)
for _ in range(a):
  mass.append(["#"] + list(input()) + ["#"])
mass.append(temp)

for retsu in mass:
  retsu = "".join(retsu)
  print(retsu)

Submission status: Accepted

Solution code:
H,W = map(int, input().split())
pix = [input() for _ in range(H)]
pix.insert(0,"#"*W)
pix.append("#"*W)
new_pix = list(map(lambda x: "#"+x+"#", pix))
print(*new_pix, sep="\n")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
INF = float("inf")


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

    pass


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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    H,W = inputMap()
    a = []
    for i in range(H):
        tmp = input()
        tmp = "#" + tmp + "#"
        a.append(tmp)
        
    tmp = ""
    for i in range(W+2):
        tmp += "#"
    
    print(tmp)
    for i in a:
        print(i)
    print(tmp)
    
    
class UnionFind(object):
	def __init__(self, n=1):
		self.par = [i for i in range(n)]
		self.rank = [0 for _ in range(n)]
		self.size = [1 for _ in range(n)]
		
	# x が属するグループを探索
	def find(self, x):
		if self.par[x] == x:
			return x
		else:
			self.par[x] = self.find(self.par[x])
			return self.par[x]
		
	# x と y のグループを結合
	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x != y:
			# メンバ数の更新
			sum = self.size[x] + self.size[y]
			self.size[x] = sum
			self.size[y] = sum
			# 短いリストを長いリストのルートに繋ぎ直す
			if self.rank[x] < self.rank[y]:
				x, y = y, x
			if self.rank[x] == self.rank[y]:
				self.rank[x] += 1
			self.par[y] = x
	
	# x と y が同じグループがどうか
	def is_same(self, x, y):
		return self.find(x) == self.find(y)
		
	# x が属するグループのメンバ数を返却
	def getSize(self, x):
		par_x = self.find(x)
		return self.size[par_x]
	
if __name__ == "__main__":
	main()

Submission status: Accepted

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

Submission status: Accepted

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

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

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().split() for i in range(h)]
 
for i in range(h):
    a[i].insert(0, "#")
    a[i].append("#")
 
a.insert(0, ["#"*(w+2)])
a.append(["#"*(w+2)])

for i in a:
    print("".join(map(str,i)))

Submission status: Accepted

Solution code:
h,w = map(int, input().split())
a = [input().split() for i in range(h)]
b = []
 
for i in range(h):
  a[i].insert(0,'#')
  a[i].append('#')
  
for i in range(w+2):
  b.append('#')
 
a.insert(0,b)
a.append(b)
  
for i in a:
  print("".join(list(map(str,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:
import sys
input=sys.stdin.readline

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

for i in range(h):
    s = input().strip()
    for j in range(w):
        a[i+1][j+1] = s[j]

for i in a:
    s = ""
    for c in i:
        s += c
    print(s)

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 range(h):
  print('#'+ a[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 j in range(h):
    print('#'+a[j]+'#')
print('#'*(w+2))

Submission status: Accepted

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

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

a.insert(0, ["#"*(w+2)])
a.append(["#"*(w+2)])
for i in a:
    print("".join(list(map(str,i))))

Submission status: Accepted

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

AHWr=[['#']*(W+2) for _ in range(H+2)]

for i in range(H+2):
    for j in range(W+2):
        if 1<= i and i<=H and 1<=j and j<=W:
            print(AHW[i-1][j-1],end="")
        else:
            print(AHWr[i][j],end="")
    print()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

ans = []
ans.append(tmp)
for c in a:
    ans.append("#"+c+"#")
ans.append(tmp)

for c in ans:
    print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
H, W = map(int, input().split())
edge = [['#'] * (W+2)]
output = edge + [['#'] + list(input()) + ['#'] for __ in range(H)] + edge
for row in output:
  row_str = ''.join(row)
  print(row_str)

Submission status: Accepted

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

Submission status: Accepted

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



# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    h, w = map(int, input().split())
    A = []
    for _ in range(h):
        A.append(input())
    for _ in range(w+2):
        print('#', end='')
    print('')
    for hh in range(h):
        print('#' + A[hh] + '#')
    for _ in range(w+2):
        print('#', end='')
    print('')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

S = ""
for i in range(W+2):
  S += "#"

A = []
A.append(S) 

for i in range(H):
  A.append("#"+input()+"#")
A.append(S)

for i in range(H+2):
  print(A[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 = list(map(int,input().split()))
a = [input() for i in range(H)]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

a, b = map(int, input().split())
l =  [[] for _ in range(a+2)]
l[0] = '#'*(b+2)
l[a+1] = '#'*(b+2)

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Picture Frame
H, W = map(int, input().split())
res = ['']*(H+2)
res[0] = '#'*(W+2)
res[-1] = '#'*(W+2)
for _ in range(H):
    res[_+1] = '#' + input() + '#'
for _ in res:
    print(_)

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:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    x, y = LI()
    a = [1, 3, 5, 7, 8, 10, 12]
    b = [4, 6, 9, 11]
    c = [2]
    if x in a and y in a:
        print("Yes")
        return
    if x in b and y in b:
        print("Yes")
        return
    if x in c and y in c:
        print("Yes")
        return
    print("No")
    return

#B
def B():
    h, w = LI()
    print("#" * (w + 2))
    for _ in range(h):
        a = ["#"]
        for s in S():
            a.append(s)
        a.append("#")
        print("".join(a))
    print("#" * (w + 2))
    return

#C
def C():
    return

#D
def D():
    return


#Solve
if __name__ == '__main__':
    B()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


main()

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:
a, b = map(int, input().split())
c = ["#" + input() + "#" for _ in range(a)]
c.insert(0, "#" * (b+2))
c.append("#" * (b+2))
for i in range(len(c)):
    print(c[i])

Submission status: Accepted

Solution code:
# ABC 62, B - picture frame
h, w = map(int, input().split(' '))
P = []
for i in range(h):
    tmp = list(input())
    tmp.insert(0, '#')
    tmp.append('#')
    P.append(tmp)



line = ['#']*(w+2)
P.insert(0, line)
P.append(line)

for row in P:
    print(''.join(row))

Submission status: Accepted

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

ans_array = [['#'] * (W + 2) for i in range(H + 2)]

for i in range(H):
    s = list(input())
    for j in range(W):
        ans_array[i + 1][j + 1] = s[j]

ans = ''
for i in range(H + 2):
    for j in range(W + 2):
        ans += ans_array[i][j]
    print(ans)
    ans = ''

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

Submission status: Accepted

Solution code:


def main():
    high, width = map(int, input().split())
    ans = [''.join(['#' for i in range(width + 2)])]
    ans = ans + ['#' + input() + '#' for i in range(high)] + ans


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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

a = ["#" * (w)] + a + ["#" * (w)]

for i in a:
    print("#" + i + "#")

Submission status: Accepted

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

def main(H,W,A):
    print("#"*(W+2))
    for i in range(H):
        print("#"+A[i]+"#")
    print("#"*(W+2))
    
if __name__ == '__main__':
    H, W = map(int, input().split())
    A = [input() for i in range(H)]
    
    main(H,W,A)