Result

AC

Duration

2008ms

Code [DL]

h,w=STDIN.each_line.map{|x|x.to_i-2}.to_a
a="#{"*"*w}**
"
puts a+"*#{" "*w}*
"*h+a

stdin

41
17

stdout

*****************
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*               *
*****************

stderr