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 (Python):
while True:
    try:
        (H,W)  =  map(int,input().split())
    except:
        exit
    
    if (H == 0 and W == 0):
         break

    s1 = "
    
    if ( W >= 3 ):
        s2 = "
    else:
        s2 = "

    print (s1)
    for i in range(0,H-2):
        print(s2)
    print(s1)
    print("")

Solution (Python):
hlist = []
wlist = []

while(1):
    h, w = map(int, input().split())
    if h == 0 and w == 0:
        break

    hlist.append(h)
    wlist.append(w)

for h, w in zip(hlist, wlist):
    for _ in range(w):
        print("
    print()

    for i in range(1, h-1):
        print("
        for j in range(1, w-1):
            print(".", end="")
        print("
        print()

    for _ in range(w):
        print("
    print()
    print()

Solution (Python):
H, W = map(int, input().split())
while not (H==0 and W==0):
    print("
    for i in range(H-2):
        print("
        print("."*(W-2),end="")
        print("
    print("
    print()
    H, W = map(int, input().split())

Solution (Python):
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    else:
        block_W = ["
        print("".join(block_W))
        for i in range(H - 2):
            block_W_middle = ["." for i in range(W - 2)]
            block_W_middle.insert(0, "
            block_W_middle.append("
            print("".join(block_W_middle))
        print("".join(block_W))
        print("\n", end = "")

Solution (Python):
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    print('

Solution (Python):
while True:
    H, W = map(int,input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        if i == 0 or i == H - 1:
            print("
        else:
            print("
    print()

Solution (Python):
import sys

while (True):
    height, width = map(int, sys.stdin.readline().split())
    if (height!=0 and width!=0) :
        for i in range (height):
            if (i==0 or i==height-1) : print('
            else :print('
        print('')
    else : break

Solution (Python):
while True:
    wh = list(map(int, input().split()))
    if wh[0] == 0 and wh[1] == 0:
        break
    else:
        for i in range(wh[0]):
            if i > 0:
                print()
            if i == 0 or i == (wh[0] - 1):
                for j in range(wh[1]):
                    print("
            else:
                for j in range(wh[1]):
                    if j == 0 or j == (wh[1] - 1):
                        print("
                    else:
                        print(".", end="")
        print("\n")

Solution (Python):
while True:
    h,w = map(int,input().split())
    if h+w == 0:
        break
    else:
        print('
        for i in range(h-2):
            print('
        print('
        print('\r')

Solution (Python):
while True:
    a = input()
    h, w = a.split(' ')
    h, w = int(h), int(w)
    
    if h == 0 and w == 0:
        break;
    
    for i in range(h):
        str = ''
        for j in range(w):
            if i == 0 or i == h - 1 or j == 0 or j == w - 1:
                str += '
            else:
                str += '.'
        print(str)
    print()

Solution (Python):
while True:
    H, W = map(int,input().split())
    if (H,W) == (0,0):
        break
    print("
    for j in range(1,H-1):
        line = []
        line = "
        for i in range(1,W-1):
            line+="."
        line+="
        print("".join(line))
    print("
    print("")

Solution (Python):
while True:
    H, W =map(int,input().split())
    if H == W == 0:
    	break
    elif W == 1:
    	for i in range(H):
    	    print("
    else:
    	print("
    	for i in range(H - 2):
    		print("
    	print("
    print()

Solution (Python):
while(1):
    H,W=map(int,input().split())
    if(H==0):
        break
    print(W*"
    for i in range(1,H-1):
        print('
    print(W*"
    print()

Solution (Python):
li = []
while True:
    h, w = [int(i) for i in input().split()]
    if h == 0 & w == 0:
        break
    else:
        li.append([h, w])
    
for i, j in li:
    for k in range(i):
        if k == 0 or k == i - 1:
            print("
            print()
        else:
            print("
            print()
    print()

Solution (Python):
while True:
    H, W = map(int, input().split())
    if (H, W) ==(0, 0):
        break
    print("
    for i in range(H-2):
        print("
    print("
    print()

Solution (Python):
while True:
        H, W = map(int,input().split())
        if H == 0 and W == 0:
                break
        else:
                print ("
                for i in range(H-2):
                        print("
                print ("
                print ()

Solution (Python):
while True:
    h, w = map(int, input().split())
    if h==w==0:
        break
    print('
    for _ in range(h-2):
        print('
    print('

Solution (Python):
while True:
	num=input().split()
	h=int(num[0])
	w=int(num[1])
	if h==0 and w==0:
		break
	else:
		print('
		for i in range(h-2):
			print('
		print('
		print('')

Solution (Python):
while 1:
    H,W = map(int, input().split())
    if [H, W] == [0, 0]:
        break
    for i in range(H):
        if i in [0, H-1]:
            print("
        else:
            print("
    print("")

Solution (Python):
while True:
	h,w=map(int,input().split())
	if h==0 and w==0:
		break
		
	for i in range(h):
		for j in range(w):
			if i==0 or i==h-1:
				print("
			else:
				if j==0 or j==w-1:
					print("
				else:
					print(".",end="")
		print("")
	print("")

Solution (Python):
while True:
    h,w = map(int, input().split())
    if w==0 and h==0:
        break
    
    s = '
    d = '.'

    for i in range(h):
        if i==0 or i==h-1:
            print(s*w)
        else:
            print(s+(d*(w-2))+s)
    
    print()

Solution (Python):





while(True):
    y,x=map(int,input().split())
    
    if x==0 and y==0:
        break
    
    else:
        for i in range(y):
            if i==0:
                print("
            elif i==y-1:
                print("
                print("")
            else:
                chuou="."*(x-2)
                print("

Solution (Python):
while True:
  h,w = map(int, input().split())
  if h == 0 & w == 0:
    break

  for i in range(h):
    for j in range(w):
      if i == 0 or j == 0 or i == h-1 or j == w-1:
        print('
      else:
        print('.', end = '')
    print()
  print()

Solution (Python):
while True:
    h, w = map(int, input().split())
    if h == w == 0: break
    print('
    for _ in range(h-2):
        print('
    print('
    print()

Solution (Python):
h, w = map(int, input().split())
result = []

while (h and w):
    result.append((h, w))
    h, w = map(int, input().split())

for item in result:
    h = item[0]
    w = item[1]
    for i in range(0, h):
        for j in range(0, w):
            if i > 0 and i < h - 1 and j > 0 and j < w - 1:
                print('.', end = '')
            elif (j == w - 1):
                print('
            else :
                print('
    print()

Solution (Python):
while True:
    H, W = map(int,input().split())
    if H == 0 and W == 0 :
        break
    print("
    for i in range(1, H - 1):
        print("
        print("." * (W - 2), end="")
        print("
    print("
    print()

Solution (Python):
i = 1

while True:
    H,W = map(int, input().split())
    if H == 0 and W == 0:
        break
    print('
    for i in range(H-2):
        print('
        i += 1
    print('
    print()

Solution (Python):
BIG_NUM = 2000000000

while True:

    H,W = map(int,input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        for k in range(W):
            if i == 0 or i == H-1 or k == 0 or k == W-1:
                print("
            else:
                print(".",end = "")
        print()

    print()

Solution (Python):
while True:
    h, w = map(int, input().split())
    if h == 0 and w == 0:
        break
    for i in range(h):
        for j in range(w):
            if i == 0 or i == h - 1 or j == 0 or j == w - 1: 
                print("
            else:
                print(".", end = "")
        print()
    print()

Solution (Python):
h, w = map(int, input().split())
while not (h == 0 and w == 0):
    for i in range(h):
        if i == 0 or i == h-1:
            print("
        else:
            print("
    print("")
    h, w = map(int, input().split())

Solution (Python):

while 1:
    h,w=map(int,input().split())
    if h==0 and w==0:
        break
    for i in range(h):
        for j in range(w):
            if i==0 or i==h-1 or j==0 or j==w-1:
                if j==w-1:
                    print("
                else :
                    print("
            else :
                print(".",end='')
    print()

Solution (Python):
def f(a,b):
    print("
    for i in range(a-2):
        print("
    print("

    print()
L = []
while True:
        a,b = map(int,input().split())
        k = [a,b]
        L.append(k)
        if a == 0 and b == 0 :
            break

for i in range(len(L)-1):
    f(L[i][0],L[i][1])

Solution (Python):
while True:
    a,b=map(int,input().split())
    if a==0 and b==0:
        break
    else:
        print('
        for i in range(a-2):
            print('
        print('

        print()

Solution (Python):
h, w = map(int, input().split())
while h != 0 or w != 0 :
        print("
        for i in range(h-2) :
                print("
        print("
        print()
        h, w = map(int, input().split())

Solution (Python):
while True:
    H, W = map(int, input().strip().split())
    if H == 0 and W == 0:
        break
    else:
        for i in range(H):
            for j in range(W):
                if i == 0 or i == H - 1 or j == 0 or j == W - 1:
                    print("
                else:
                    print(".", end="")
            print()
        print()

Solution (Python):
while True:
    h, w = map(int, input().split())
    if h == w == 0:
        break
    print('
    m = h - 2
    for i in range(h - 2):
        print('
    print('
    print()

Solution (Python):
while True:
    H, W = map(int, input().split())
    if H == W == 0:
        break
    frame = ["
    inside = ["
    for i in range(W - 2):
        frame.insert(1, "
        inside.insert(1, ".")
    frame = "".join(frame)
    inside = "".join(inside)
    print(frame)
    for i in range(H - 2):
        print(inside)
    print(frame)
    print()

Solution (Python):
import sys
input_lines = sys.stdin.readlines()[:-1]
for input_ in input_lines:
    h, w = [int(i) for i in input_.split()]
    if w == 1:
        for i in range(h):
            print('
    elif h == 1:
        print('
    else:
        out_ = '
        in_ = '{0}{1}{0}'.format('
        print(out_)
        for i in range(h-2):
            print(in_)
        print(out_)
    print()

Solution (Python):
while True:
    h,w = map(int,input().split())
    if h == 0 and w == 0:
        break
    print('
    for i in range(h-2):
        print('
    if h > 1:
        print('
    print("")

Solution (Python):
while True:
    H,W=map(int,input().split())
    if H==W==0:
        break
    print('
    for i in range(H-2):
        print('
    print('
    print('')

Solution (Python):
while True:
  h, w = list(map(int, input().split()))
  if h==w==0:
    break
  print("
  for i in range(h-2):
    print("
  print("
  print()

Solution (Python):
while True:
    a,b = map(int,input().split())
    if a == 0 and b==0:
        break
    for i in range(a):
        if i == 0 or i == a-1:
            print("
        else:
            for s in range(b):
                if s == 0:
                    print("
                elif s == b-1:
                    print("
                else:
                    print(".",end='')
    print('')

Solution (Python):
while True:
    (H, W) = [int(i) for i in input().split()]
    
    if H == W == 0:
        break
    for hc in range(H):
        if hc == 0 or hc == H - 1:
            print('
        else:
            print('
    print()

Solution (Python):
sss = input()
while not sss == '0 0':
	ss = sss.split(' ')
	H = int(ss[0])
	W = int(ss[1])
	for i in range(1, H+1):
		sh = ''
		for j in range(1, W+1):
			if (j > 1 and j < W) and (i > 1 and i < H):
				sh += '.'
			else:
				sh += '
		print(sh)
	print('')
	sss = input()

Solution (Python):


def main():

	while True:
		H,W = map(int,raw_input().split())
		if H == W == 0:
			break
		a = ''
		b = '
		for i in xrange(W):
			a += '
		for i in xrange(W-2):
			b += '.'
		b += '
		print(a)
		for i in xrange(H-2):
			print(b)
		print(a)
		print('')

if __name__ == "__main__":

	main()

Solution (Python):
data = []
tmp = []
for x in range(0,1000000):
    a,b = map(int, input().split())
    if a==0:
        if b==0:
            break
        pass
    data.append((a,b))
for x in range(0,len(data)):
    tmp = list(data.pop(0))
    for y in range(0,tmp[0]):
        for z in range(0,tmp[1]):
            if z==0:
                print("
            elif y==0:
                print("
            elif z==tmp[1]-1:
                print("
            elif y==tmp[0]-1:
                print("
            else:
                print(".",end='')
        print("")
    tmp.clear()
    print("")