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: Accepted)

function Main(input){
  let data = input.split('\n');
  let arr, row, col;
  for (let i = 0; i < data.length; i++){
    arr = data[i].split(' ');
    row = arr[0];
    col = arr[1];
    if (row === '0' && col === '0'){
      break;
    }
    let s ='';
    let t = '';
    for (let j = 0; j < col; j++){
      s += "#";
      if (j === 0){
      t += "#";
      } else if (j === col -1) {
        t += "#";
        break;
      } else{
        t+='.';
      }
    }
    for (let k = 0; k < row; k++){
      if(k === 0){
        console.log(s);
      } else if (k === row - 1){
        console.log(s);
        break;
      } else {
        console.log(t);
      }      
    }
    console.log('');
    }
  }

Main(require("fs").readFileSync("/dev/stdin", "utf8"));