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

answer = ""
for i in range(W+2):
    answer += "#"
answer += "\n"
for pic in gazo:
    answer += "#"
    answer += "".join(pic)
    answer += "#"
    answer += "\n"
for i in range(W+2):
    answer += "#"

print(answer)

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

Submission status: Accepted

Solution code:
from collections import defaultdict


def main():
    H, W = map(int, input().split())
    ans = ["#" * (W + 2)]
    for _ in range(H):
        ans += ["#" + input().strip() + "#"]
    ans += ["#" * (W + 2)]
    print("\n".join(ans))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# Picture Frame

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

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

Submission status: Accepted

Solution code:
h,w = map(int,input().split())
word = []
for i in range(h):
    word.append(input())
 
print("#" * (w + 2))
for i in range(h):
    print("#" + word[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:
from functools import reduce
h,w = [int(i) for i in input().split()]
a = []
for i in range(0,h):
    a.append('#' + input() + '#')
udFrame = reduce(lambda x,y: x+y, ['#' for i in range(0,w+2)])
print(udFrame)
for pic in a:
    print(pic)
print(udFrame)

Submission status: Accepted

Solution code:
import sys

H,W = raw_input().split()
a =[]
for line in range(int(H)):
    a.append(raw_input())

for i in range(0,int(W)+2):
    sys.stdout.write("#")
print

for i in range(0,int(H)):
    sys.stdout.write("#")
    for j in range(0,int(W)):
        sys.stdout.write(a[i][j])
    sys.stdout.write("#")
    print

for i in range(0,int(W)+2):
    sys.stdout.write("#")
print

Submission status: Accepted

Solution code:
#!/usr/bin/python

from numpy import *

H, W = raw_input().split()

h = int(H)
w = int(W)

a = []

for i in range(h):
    a.append(raw_input())

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

temp = '#'

for i in range(len(a[i]) - 1):
    temp = temp + '#'

print temp

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

print temp

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

import sys
import subprocess
import json
import time
import math
import re
import sqlite3

H, W = map(int, input().split())
a = []

a.append('#' * W)

for i in range(H):
    a.append(input())
    
a.append('#' * W)

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

Submission status: Accepted

Solution code:
#Python

A=map(int, raw_input().split())
H=A[0]
W=A[1]

print "#"*(W+2)

for i in range(H):
    print "#"+raw_input()+"#"

print "#"*(W+2)

Submission status: Accepted

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

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

print('#' * (w + 2))
for row_a in a:
    print('#' + row_a + '#')
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:
import sys

# sys.stdin = open('b1.in')


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

s = '#' * (w + 2)
print(s)
for ligne in a:
    l = list(ligne)
    l.append('#')
    l.insert(0, '#')
    ligne2 = ''.join(l)
    print(ligne2)
print(s)

Submission status: Accepted

Solution code:
H, W = map(int, raw_input().split())
picture = [list("#"*(W+2)) for _ in xrange(H+2)]
for i in xrange(1, H+1):
    a = list(raw_input())
    for j in xrange(1, W+1):
        picture[i][j] = a.pop(0)
for p in picture:
    print "".join(p)

Submission status: Accepted

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

print '#' * (w+2)
for i in range(h):
    print '#{}#'.format(raw_input())
print '#' * (w+2)

Submission status: Accepted

Solution code:
a=input().split()
x=int(a[1])+2
s=[]
for i in range(int(a[0])):
    s.append(input())
print("#"*x)
for i in range(int(a[0])):
    print("#"+s[i]+"#")
print("#"*x)

Submission status: Accepted

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

for i in range(h):
    print("#",end="")
    print(s[i],end="")
    print("#")
for i in range(w+1):
    print("#",end="")
print("#")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
indata = raw_input().split()
i = int(indata[0])
j = int(indata[1])
pixcel = []

for count in range(i):
    datalist = raw_input()
    pixcel.append(datalist)

showline = []
headder = ""
l = ""

for x in range(j + 2):
    headder = headder + "#"
showline.append(headder)

for s in pixcel:
   l = "#" +  s + "#"
   showline.append(l)
showline.append(headder)

for line in showline:
    print line

Submission status: Accepted

Solution code:
#coding:utf-8

h, w = [int(x) for x in input().split()]
strs = [input() for x in range(h)]

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

Submission status: Accepted

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

import sys

input = [int(i) for i in sys.stdin.readline().split(' ')]
input_matrix = []

for i in range(input[0]):
	input_matrix.append(sys.stdin.readline().replace('\n',''))

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

for i in range(input[0]):
	print('#',end='')
	print(input_matrix[i],end='')
	print('#',)
	
for i in range(input[1] + 2):
	print('#',end='')

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# input
x, y = [int(i) for i in input().split()]
s = [input() for i in range(x)]

ans = []

r0 = ''
for i in range(y+2):
    r0 += '#'
ans.append(r0)

for ss in s:
    ans.append('#' + ss + '#')

ans.append(r0)

for a in ans:
    print(a)

Submission status: Accepted

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

image = ["".join(["#"] + input().split() + ["#"]) for i in range(h)]
image.insert(0, "#"*(w+2))
image.append("#"*(w+2))

for i in image:
    print(i)

Submission status: Accepted

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

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

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

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

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

Submission status: Accepted

Solution code:
a = input().split()
h = int(a[0])
w = int(a[1])

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

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

Submission status: Accepted

Solution code:

x = list(map(int, input().split()))
a=[input() for i in range(x[0])]

for i in range(x[1]+2):
    print('#',end="")
print('')
for i in a:
    print('#{0}#'.format(i))
for i in range(x[1]+2):
    print('#',end="")
print('')

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    height, width = list(map(int, input().split()))
    input = [input() for i in range(height)]

    sharps = "#" + "#" * width + "#"
    print(sharps)
    for i in range(height):
        print("#", end="")
        print(input[i], end="")
        print("#")
    print(sharps)

Submission status: Accepted

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

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

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

for i in A:
    print(i)

Submission status: Accepted

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

sha = ''.join(['#' for i in range(w + 2)])
a = [sha]

for j in range(h):
    a.append('#' + input() + '#')

a.append(sha)

for k in a:
    print(k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    h,w = LI()
    a = ['#'*(w+2)] + ['#' + S() + '#' for _ in range(h)] + ['#'*(w+2)]

    return '\n'.join(a)



print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
y, x = map(int, input().split(" "))
 
h = []
for v in range(0, x+2):
    h.append("#")
    
h = ''.join(h)
print(h)
for v in range(0, y):
    print("#" + input() + "#")
 
print(h)

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] = input()
    a[i] = "#"+a[i]+"#"
s=["#"*(w+2)]
a.extend(s)
s.extend(a)
for a_ in s:
    print(a_)

Submission status: Accepted

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

import Queue

def output_frame(w):
    f = ""
    for i in range(w+2):
        f += "#"
    return f

H,W = map(int, raw_input().split())
q_str = Queue.Queue()
for i in range(H):
    q_str.put(raw_input())

print output_frame(W)
while not q_str.empty():
    print "#" + q_str.get() + "#"
print output_frame(W)

Submission status: Accepted

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

s = []
for i in range(h):
  s.append(raw_input())

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

Submission status: Accepted

Solution code:
def solve():
    H,W=map(int,input().split())
    for i in range(W+2):
        print("#",end='')
    print()
    for i in range(H):
        print("#",end='')
        s=input()
        print(s,end='')
        print("#")
    for i in range(W+2):
        print("#",end='')
    print()

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
H,W=map(int,input().split())
a=[]
[a.append(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:
h, w = [int(n) for n in input().split()]

ans=''
for i in range(h):
    ans+='#'+input()+'#'+'\n'
print('#'*(w + 2))
print(ans+'#'*(w + 2))

Submission status: Accepted

Solution code:

H, W = [int(n) for n in input().split()]
image = []
for i in range(H):
    image.append(input())

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

Submission status: Accepted

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


inputs = []
for i in range(H):
    inputs.append(input())

first_line = "".join("#" for i in range(W+2))

print(first_line)
for i in range(H):
    print("#" + inputs[i] + "#")
print(first_line)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
y, x = map(int, input().split())
image = ["#" * (x+2)]
for y in range(0,y):
    image.append("#"  + input() + "#")
image.append("#" * (x+2))
for img in image:
    print(img)

Submission status: Accepted

Solution code:
from __future__ import division
import math


def get_min(w, h):
    m = 1e11
    for x in [w // 3, w // 3 + 1]:
        if x == 0: continue
        a = [x*h, (w-x)*(h//2), (w-x)*(h - h//2)]
        print a
        m = min(m, max(a) - min(a))
    return m

digits = raw_input()
a, b = [int(x) for x in digits.split(' ')]
m = []
for i in range(a):
    s = raw_input()
    m.append(s)
print ''.join(['#'] * (b + 2))
for i in range(a):
    print '#' + m[i] + '#'
print ''.join(['#'] * (b + 2))

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in a:
    print("#",end="")
    for j in i:
        print(j,end="")
    print("#")

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
y, x = map(int, input().split(" "))
line = "#" * (x + 2)
print(line)
for n in range(y):
    line = input()
    print("#{}#".format(line))
line = "#" * (x + 2)
print(line)

Submission status: Accepted

Solution code:
""" abc062_b:B - Picture Frame """
L = input().rstrip().split(' ')
H = int(L[0])
W = int(L[1])

print("".rjust(W + 2, '#'))
for i in range(H):
    print("#" + input() + "#")
print("".rjust(W + 2, '#'))

Submission status: Accepted

Solution code:
s = input().split()
h = int(s[0])
w = int(s[1])

ain = ["" for i in range(h)]

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

aout = ["" for j in range(h+2)]

aout[0] = "#" * (w+2)

for i in range(h):
    aout[i+1] = "#" + ain[i] + "#"

aout[h+1] ="#" * (w+2)

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

Submission status: Accepted

Solution code:
h, w = map(int, input().strip().split(' '))
horizontal_frame = "##" + "#" * w

print(horizontal_frame)
for i in range(h):
    image_row = "#" + input().strip() + "#"
    print(image_row)
print(horizontal_frame)

Submission status: Accepted

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

src = []
for i in range(H):
    src.append(raw_input())

print "#" * (W + 2)
for row in src:
    print "#" + row + "#"
print "#" * (W + 2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
buf = input()
H,W = buf.split()
H = int(H)
W = int(W)
pic = []
 
for i in range(H):
    pic.append(input())
 
#for row in pic:
#    print(row)
 
for i in range(W+2):
    print("#",end="")
print()
 
for i in range(H):
    print("#"+pic[i]+"#")
 
for i in range(W+2):
    print("#",end="")

Submission status: Accepted

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

Submission status: Accepted

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

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

if __name__ == '__main__':
	picture_frame()

Submission status: Accepted

Solution code:
import sys

h, w = [int(x) for x in sys.stdin.readline().split()]

def printer(h,w):
	for _ in range(h):
		s = input()
		s = s.replace(' ','')
		print('#'+s+'#')

print('#'*(w+2))
printer(h, w)
print('#'*(w+2))

Submission status: Accepted

Solution code:
a = input().split(" ")

tmp_out=[[""] for i in range(int(a[0])+2)]

for j in range(int(a[1])+2):
    tmp_out[0]=["".join(tmp_out[0]+["#"])]

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

tmp_out[int(a[0])+1]=tmp_out[0]

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

Submission status: Accepted

Solution code:
a = input().split(" ")

tmp_out=[[""] for i in range(int(a[0])+2)]

for j in range(int(a[1])+2):
    tmp_out[0]=["".join(tmp_out[0]+["#"])]

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

tmp_out[int(a[0])+1]=tmp_out[0]

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

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 = [int(x) for x in input().split(' ')]

ans = (w + 2) * '#' + '\n'

for i in range(h):
    ans += '#' + input() + '#\n'

ans += (w + 2) * '#'

print(ans)

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
H, W = map(int, input().split())
a = []
b = []
for tmp in range(H):
    a.append(list(input()))
add = [ '#' for tmp in range(W+2) ]
b.append(add)
for tmp in range(H):
    c = ['#'] + a[tmp] + ['#']
    b.append(c)
b.append(add)
for tmp in range(H+2):
    print(''.join(b[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(" "))

ans = list()
head = "#" * (W + 2)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

A = [raw_input() for _ in range(H)]

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

Submission status: Accepted

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


blank = ["#" for i in range(W + 2)]
print("".join(blank))
for line in range(H):
    print("#" + input() + "#")
print("".join(blank))

Submission status: Accepted

Solution code:
from sys import stdin
n,m = map(int,stdin.readline().split())
x = '#' * (m+2)
print x 
for _ in xrange(n):
    a = stdin.readline().strip()
    print '#'+a+'#'
print x

Submission status: Accepted

Solution code:
H, W = map(int, raw_input().split())
print "#" * (W+2)
for y in range(H):
    s = raw_input()
    print "#" + s + "#"
print "#" * (W+2)

Submission status: Accepted

Solution code:
import sys

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

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

    for i in range(h):
        s = '#' + input() + '#'
        print(s)

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

if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

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


h, w = read()
lines = [input() for y in range(h)]

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

for line in lines:
    print("#", end="")
    print(line, end="")
    print("#")

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
h,w=map(int,raw_input().split())
r='#'*(w+2)
s=[]
s.append(r)
for i in xrange(h):
 t='#'+raw_input()+'#'
 s.append(t)
s.append(r)
for i in xrange(h+2):
 print s[i]

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in range(H):
        print('#', end = "")
        print(str[i], end = "")
        print('#')

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

Submission status: Accepted

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

x, y = map(int,raw_input().split())

print "#" * (y + 2)

for i in range(x):
	a = raw_input()
	print "#" + a + "#"

print "#" * (y + 2)

Submission status: Accepted

Solution code:
inputnums = input().split()                                                                   
x = int(inputnums[0])
y = int(inputnums[1])
inputstr=[]
for i in range(x):
        inputstr.append(input())
pixel=[]
pixel.append("#"*(len(inputstr[-1])+2))
for i in range(x):
        pixel.append("#"+inputstr[i]+"#")


pixel.append("#"*len(pixel[-1]))
output=""
for i in range(len(pixel)):
    output+=pixel[i]+"\n"

print(output)

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+1):
    print('#',end='')
print('#')
for i in range(h):
    print('#',end='')
    print(a[i],end='')
    print('#')
for i in range(w+1):
    print('#',end='')
print('#')

Submission status: Accepted

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

Submission status: Accepted

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

print("#" * W)
for i in range(H):
    print("#", end = "")
    print(input().strip(), end = "")
    print("#")

print("#" * W)

Submission status: Accepted

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

H,W=map(int,raw_input().split())
arr=[['#']*W]*H
for i in range(H):
    line=map(str,raw_input())
    line.insert(0,'#')
    line.append('#')
    arr[i]=line

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

Submission status: Accepted

Solution code:
nums = [int(x) for x in input().split()]

pic = []
for i in range(nums[0]):
	line = input()
	pic.append(line)

for i in range(nums[1]+2):
	print("#", end="")
print("\n", end="")
for words in pic:
	print("#", end="")
	print(words, end="")
	print("#")

for i in range(nums[1]+2):
	print("#", end="")
print("\n", end="")

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

Submission status: Accepted

Solution code:
size = input()
size = size.split()

print("#" * (int(size[1]) + 2))

for i in range(int(size[0])):
	row = input()
	print("#" + row + "#")

print("#" * (int(size[1]) + 2))

Submission status: Accepted

Solution code:
data = input().split()
H = int(data[0])
W = int(data[1])

str = []
for i in range(H):
	data = input()
	str.append(data[:W])

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

Submission status: Accepted

Solution code:
import sys

if __name__ == '__main__':
    count = 0
    D = []
    for line in sys.stdin:
        if count == 0:
            line = line.rstrip("\n").split(" ")
            H = int(line[0])
            W = int(line[1])
            count+=1

        else:
            D.append(line.rstrip("\n"))

    print("".join(["#"]*(W+2)))
    for i in range(len(D)):
        print("#"+D[i]+"#")
    print("".join(["#"]*(W+2)))

Submission status: Accepted

Solution code:
N, M = map(int ,raw_input().split())
s="#"*(M+2)
a=[]

a.append(s)
for i in range(N):
    a.append("#"+raw_input()+"#")
a.append(s)

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

Submission status: Accepted

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


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

for i in range(h):
    print("#{}#".format(pic[i][0]))

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h, w = map(int, input().split())
lst = []
for i in range(h):
    lst.append(list(input().split()))
    lst[i].insert(0, "#")
    lst[i].append("#")
head = ["#" for i in range(w+2)]
bottom = head

print("".join(head))
for i in range(h):
    print("".join(lst[i]))
print("".join(bottom))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
H, W = [int(x) for x in input().split()]
image = list()
for i in range(H):
	image.append('#' + input() + '#')

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

Submission status: Accepted

Solution code:

mat_small = []
xy = input().split(' ')
for i in range(int(xy[0])):
    mat_small.append(input())

big  = [(int(xy[1])+ 2)* '#'  for a in range(int(xy[0])+ 2) ]

for s in range(1, (int(xy[0])+ 1)):
    big[s] = '#' + mat_small[s-1] + '#'

for v in big:
    
    print(v)

Submission status: Accepted

Solution code:
def solve() :
    ri = raw_input()

    inarr = ri.split(' ')
    h = inarr[0]
    w = inarr[1]

    print '#' * (int(w) + 2)
    for i in range(0, int(h)) :
        line = raw_input()
        print ('#' + line + '#')
    print '#' * (int(w) + 2)

if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def picture_frame():
	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))

if __name__ == '__main__':
	picture_frame()

Submission status: Accepted

Solution code:
x, y = map(int,input().split())

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

for i in range(x) :
  print ('#', end = '')
  print (input(), end = '')
  print ('#')

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

Submission status: Accepted

Solution code:
def main():
    H, W = map(int, input().split())
    a = [None] * H
    i = 0
    while i < H:
        a[i] = str(input())
        i += 1

    print('#' * (W + 2))
    for s in a:
        print('#{}#'.format(s))
    print('#' * (W + 2))

main()

Submission status: Accepted

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

print("#"*(M+2))
for i,b in enumerate(a):
  print("#"+a[i]+"#")
print("#"*(M+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:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
H,W = map(int,raw_input().split(" "))

lista = []
for i in range(H):
	lista.append([map(str,raw_input().split(" "))])

result = []
stre = ""
for i in range(W+2):
	stre = stre + "#"

print stre

for i in lista:
	stre1 = "#"
	for k in i:
		stre1 = stre1 + k[0]
	stre1 = stre1 + "#"
	print stre1

print stre

Submission status: Accepted

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

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

Submission status: Accepted

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

matrix = []
matrix.append("#"*(W+2))
for i in range(H):
    a = input()
    matrix.append("#"+a+"#")
matrix.append("#"*(W+2))

for s in range(H+2):
    print(matrix[s])

Submission status: Accepted

Solution code:
# coding: utf-8

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

pic = [["#" for _j in xrange(w+2)] for _i in xrange(h+2)]

for i in xrange(h):
    aij = raw_input()

    for j in xrange(len(aij)):
        pic[i+1][j+1] = aij[j]

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