Problem:
Print a Frame

Draw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm.

##########
#........#
#........#
#........#
#........#
##########

Input

The input consists of multiple datasets. Each dataset consists of two integers H and W separated by a single space.

The input ends with two 0 (when both H and W are zero).

Output

For each dataset, print the frame made of '#' and '.'.

Print a blank line after each dataset.

Constraints

3 ≤ H ≤ 300

3 ≤ W ≤ 300

Sample Input

3 4
5 6
3 3
0 0

Sample Output

####
#..#
####

######
#....#
#....#
#....#
######

###
#.#
###

Solution in Ruby (judge verdict: Accepted)


arr = []
while true
  val1, val2 = gets.split(" ").map(&:to_i)
  break if val1.zero? && val2.zero?
  arr << [ val1, val2 ]
end

arr.each do |val|
  str = ""
  val[0].times do |ind1|
    val[1].times do |ind2|
      if ind1 == 0
        str += "#"
      elsif ind2 == 0
        str += "#"
      elsif ind1 == (val[0] - 1)
        str += "#"
      elsif ind2 == (val[1] - 1)
        str += "#"
      else
        str += "."
      end
    end
    str += "\n"
  end
  puts str
  puts "\n"
end