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 C# (judge verdict: Accepted)

using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;

public class Program
{

	public void Proc()
	{
        System.Text.StringBuilder ans = new System.Text.StringBuilder();
        while(true) {
            string inpt = Reader.ReadLine();
            if(inpt == null) {
                break;
            }
            int[] size = inpt.Split(' ').Select(a => int.Parse(a)).ToArray();
            if(size.Count(a=>a<3)>=2) {
                break;
            }
            ans.AppendLine(GetAns(size[0], size[1]));

        }
        Console.Write(ans.ToString());
    }


    private string GetAns(int h, int w) {
        System.Text.StringBuilder ret = new System.Text.StringBuilder();
        for (int i = 0; i < h; i++) {
            if(i==0 || i==h-1) {
                ret.AppendLine("".PadLeft(w, '#'));
            } else {
                ret.AppendLine("#".PadRight(w-1, '.') + "#");
            }
        }
        return ret.ToString();
    }


    public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"



3 4
5 6
3 3
0 0



";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}