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 JavaScript (judge verdict: WA: Presentation Error)

// 'use strict';
(function(stdin) {
  //declare function
  var square = function(a) {
    var h = a[0];
    var w = a[1];
    var top = [];
    var midle = [];
    var result = [];
    for (var i = 0; i < w; i++) {
      top.push('#');
    }
    for (var j = 0; j < w - 2; j++) {
      midle.push('.');
    }
    midle.push('#');
    midle.unshift('#');
    for (var k = 0; k < h - 2; k++) {
      result.push(midle.join(''));
    }
    result.push(top.join(''));
    result.unshift(top.join(''));
    return result.join('\n');
  }

  //declare variable
  var inputs = stdin.toString().trim().split('\n');
  var numData = inputs.slice(0, inputs.indexOf('0 0'));
  var HAndW = numData.map(function(v) {
    return v.split(' ').map(Number);
  });
  var all = [];
  //main
  for (var l = 0, len = HAndW.length; l < len; l++) {
    all.push(square(HAndW[l]));
  }
  //display
  console.log(all.join('\n\n'));
})(require('fs').readFileSync('/dev/stdin', 'utf8'));