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):
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    fr = ''
    for i in range(W):
        fr += '
    fr += '\n'
    for i in range(H-2):
        fr += '
        for j in range(W-2):
            fr += '.'
        fr += '
    for i in range(W):
        fr += '
    fr += '\n'
    print(fr)

Solution (Python):

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

Solution (Python):
import sys
while True:
    ls = map(int, raw_input().split())
    if ls[0]==0 and ls[1]==0:
        break
    for h in xrange(ls[0]):
        for w in xrange(ls[1]):
            if h==0 or h==ls[0]-1 or w==0 or w==ls[1]-1:
                sys.stdout.write('
            else:
                sys.stdout.write('.')
        print ''
    print ''

Solution (Python):
while True:
	H,W = map(int,raw_input().split(" "))
	if (H == W == 0):
		break
	print("

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

Solution (Python):
while True:
    h,w = map(int,raw_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):
class PrintAFrame:
    def output(self, H, W):
        s1 = ""
        s2 = ""
        for w in range(W):
            s1 += "
            if w == 0 or w == W - 1:
                s2 += "
            else:
                s2 += "."
        for h in range(H):
            if h == 0 or h == H - 1:
                print s1
            else:
                print s2
        print

if __name__ == "__main__":
    pf = PrintAFrame()
    while True:
        h, w = map(int, raw_input().split())
        if h == 0 and w == 0:
            break
        pf.output(h, w)

Solution (Python):
import sys

k = 0

while k == 0:
    r = raw_input()
    H, W = r.split()
    H = int(H)
    W = int(W)
    
    if H == 0 and W == 0:
        k = 1
    else:
        for j in range(H):
            for i in range(W):
                if i == 0 or i == W-1 or j == 0 or j == H-1:
                    sys.stdout.write("
                else:
                    sys.stdout.write(".")
            print("")
        print("")

Solution (Python):
all_N = []
while True:
	N = list(map(int, input().split(' ')))
	if N[0] == 0 and N[0] == 0:
		break
	all_N.append(N)

for i in range(len(all_N)):
	print('
	for j in range(all_N[i][0]-2):
		print('
	print('
	print('')

Solution (Python):
while True:
        k=map(int,raw_input().split())
        H=k[0]
        W=k[1]
        if H+W==0:
                break
        else:
                print '
                if H==1:
                        break
                if H==2:
                        print '
                if H>2:
                        for i in range(H-2):
                                print '
                        print '
        print ""

Solution (Python):
import sys

while 1:
	h, w = map(int, raw_input().split())
	if h == 0 and w == 0:
		break
	else:
		for i in xrange(h):
			if i == 0 or i == (h-1):
				for j in xrange(w):
					sys.stdout.write("
				print ""
			else:
				sys.stdout.write("
				for j in xrange(w-2):
					sys.stdout.write(".")
				print "
	print ""

Solution (Python):

while True:
    (H,W) = [int(s) for s in input().split()]
    if H == W == 0:
        break
    for i in range(H):
        if i ==0 or i == H-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(H-2):
        print("
    print('
    print()

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

    print('
    for i in range(0, h - 2):
        print('
    print('
    print()

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

        print("
    print("")

Solution (Python):
a, b = (int(i) for i in input().split())
while a != 0 and b != 0:
    cow = '
    for i in range(1, b):
        cow += '
    print('{0}'.format(cow))
    for i in range(1, a-1):
        row = '
        for j in range(1, b-1):
            row += '.'
        row += '
        print('{0}'.format(row))
    cow = '
    for i in range(1, b):
        cow += '
    print('{0}'.format(cow))
    print()
    a, b = (int(i) for i in input().split())

Solution (Python):
a, b = (int(i) for i in input().split())
while a != 0 and b != 0:
    cow = '
    for i in range(1, b):
        cow += '
    print('{0}'.format(cow))
    for i in range(1, a-1):
        row = '
        for j in range(1, b-1):
            row += '.'
        row += '
        print('{0}'.format(row))
    cow = '
    for i in range(1, b):
        cow += '
    print('{0}\n'.format(cow))
    a, b = (int(i) for i in input().split())

Solution (Python):
















































H=[]
W=[]

while 1:
	temp = input().split()
	H.append( int(temp[0]) )
	W.append( int(temp[1]) )
	if H[-1]==0 and W[-1]==0:
		break;

for i in range( len(H) ):
	for j in range( H[i] ):
		
		if j==0 or j==H[i]-1: 		
			for k in range( W[i] ):
				print("
		else:
			print("
			for k in range(W[i]-2):
				print(".",end="")
			print("

		print("")
		

	if i !=len(H)-1:
		print("")

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

        print("
    print("")

Solution (Python):


def main():
	boxes = []
	while True:
		h, w = [int(i) for i in input().split(" ")]
		if h == 0 and w == 0:
			break
		boxes.append([h, w])
	for i in boxes:
		print("
		for j in range(i[0] - 2):
			print("
		print("
		print()
	return
if __name__ == '__main__':
  main()

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

Solution (Python):
def print_side(W):
    for j in range(W):
        print("
    print("")

def print_body(W):
    for j in range(W):
        if j==0 or j==W-1: 
            print("
        else:
            print(".",end="")
    print("")

while True:
    H,W = [int(x) for x in input().split()]
    if (H,W)==(0,0): break
    for i in range(H):
        if i==0 or i==H-1:
            print_side(W)
        else:
            print_body(W)
    print("")

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

Solution (Python):
import math

H, W = map(int, raw_input().split())

while H > 0 or W > 0 :
    print "

    for i in xrange(H-2) :
        print "

    print "
    print

    H, W = map(int, raw_input().split())

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

Solution (Python):
while True:
    (H,W) = [int(x) for x 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):
while True:
    n = input().split()
    a,b = int(n[0]),int(n[1])
    if a == 0 and b == 0:
        break
    elif a == 0 or b ==0:
        print()
    else:
        for i in range(a):
            if i == 0 or i == a-1:
                print('
            else:
                print('
        print()

Solution (Python):
while(True):
        h,w = [int(i) for i in input().split()]
        if h == 0 and w == 0:
                break
        for i in range(h):
                out = ''
                for j in range(w):
                        if j == 0 or j == (w-1) or i == 0 or i == (h-1):
                                out += '
                        else :
                                out += '.'
                print(out)
        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):
while True:
    H, W = map(int, input().split())
    if H == W == 0:
        break
    for i in range(1, H + 1):
        if i == 1 or i == H:
            print("
        else:
            print("
    print()

Solution (Python):
while(True):
    a=list(map(int,input().split()))
    if(a[0]==0 and a[1]==0):
        break
    for x in range(a[0]):
        if x==0 or x==a[0]-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):
        a = ""
        for j in range(W):
            if i == 0 or i == (H-1):
                a += "
            elif j == 0 or j == (W-1):
                a += "
            else:
                a += "." 
        print(a)
    print("")

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

    if h == 0 and w == 0:
        break

    for y in range(1, h + 1):
        for x in range(1, w + 1):
            if y == 1 or y == h:
                print('
            else:
                if x == 1 or x == w:
                    print('
                else:
                    print('.', end='')
        print('')
    print('')

Solution (Python):
import sys
a = []
while True:
    x = map(int, raw_input().split())
    if x[0] == 0 and x[1] == 0:
        break
    a.append(x)
for i in range(len(a)):
    for j in range(a[i][0]):
        if j == 0 or j == (a[i][0]-1):
            for k in range(a[i][1]):
                sys.stdout.write('
        else:
            sys.stdout.write('
            for k in range(a[i][1]-2):
                sys.stdout.write('.')
            sys.stdout.write('
        print ''
    print ''

Solution (Python):
def print_frame(h,w):
    if h == 1:
        print("
        return
        
    if h == 2:
        print("
        print("
        return

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

while True:
    h,w = map(int,input().split())
    if h == 0 and w == 0:
        break;
    else :
        print_frame(h,w)
        print()

Solution (Python):
while True:
    H,W = map(int,input().split())
    if(H == W == 0):
        exit()
    for y in range(H):
        for x in range(W):
            if(y == 0 or x == 0 or y == H-1 or x == W-1):
                print("
            else:
                print(".",end="")
        print("")
    print("")

Solution (Python):
def draw_frame(h, w):
	print("
	print(("
	print("

while True:
	H, W = map(int, input().split())
	if H == W == 0: break
	draw_frame(H, W)

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

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

Solution (Python):
while True:
        (H, W) = [int(i) for i in input().split()]
        if H == W == 0:
            break
        print ("\n".join(["".join(["
        print()

Solution (Python):
while True:
    (H, W) = [int(i) for i in input().split()]
    if H == W == 0:
        break

    [print('
    print()

Solution (Python):
while True:
    H, W = [int(i) for i in input().split()]
    if H == W == 0:
        break

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

        print()

    print()

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

Solution (Python):
while True:
    H, W = [int(i) for i in input().split()]
    if H == W == 0:
        break

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

        print()

    print()

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

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

Solution (Python):
while True:
    H, W = [int(i) for i in input().split()]
    if H == W == 0:
        break

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

        print()

    print()

Solution (Python):
while True:
    H, W =[int(i) for i in input().split()]
    if H == W == 0:
        break

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

        print()

    print()

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

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

Solution (Python):
while True:
    H, W = [int(i) for i in input().split()]
    if H == W == 0:
        break

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

        print()
    print()

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

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

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

Solution (Python):
while True:
    (H, W) = [int(i) for i in input().split()]
    if H == W == 0:
        break
    print('
    for a in range(H-2):
        print('
    print('
    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('
	print( ('

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

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

Solution (Python):
def draw(h,w):
	s = "
	k = "
	print s
	for i in range(0,h-2):
		print k
	print s
	print

if __name__ == "__main__":
	while True:
		h,w = map(int, raw_input().split())
		if h==0 and w==0:
			break
		else:
			draw(h,w)

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

Solution (Python):
while True:
    a = input()
    b = a.split(' ')
    H = int(b[0])
    W = int(b[1])
    if H == 0 and W == 0:
        break
    print('
    for i in range(H-2):
        print('
    print('
    print()

Solution (Python):
import sys

d = sys.stdin.readlines()
for i in d:
    h, w = [int(x) for x in i.split()]
    if h == 0 and w == 0:
        break
    for j in range(h):
        if j == 0 or j == h - 1:
            print('
        else:
            print('
    print('')

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

Solution (Python):
HW = input().split()
H = int(HW[0])
W = int(HW[1])

while H != 0 or W != 0:
    for j in range(W):
        print("
    print("")
    if W>1:
        if H>1:
            for i in range(H-2):
                print("
                for j in range(W-2):
                    print(".", end = "")
                print("
                print("")
            for j in range(W):
                print("
            print("")  
    HW = input().split()
    H = int(HW[0])
    W = int(HW[1])
    print("")

Solution (Python):



def draw_topbottom(n):
    a = ""
    for i in range(n):
        a += "
    print a

def draw_middle(n):
    a = "
    for i in range(n-2):
        a += "."
    a += "
    print a

while 1:
    HW = raw_input().split()
    H = int(HW[0])
    W = int(HW[1])

    if H == 0 and W == 0:
        break

    draw_topbottom(W)
    for i in range(H-2):
        draw_middle(W)
    draw_topbottom(W)
    print ""

Solution (Python):
while True:
    
    H, W = map(int, raw_input().split())

    if H == 0 and W == 0:
        break

    print "
    for i in range(H-2):
        print "
    print "

    print ""

Solution (Python):
import sys

while True:
    data = sys.stdin.readline().strip().split(' ')
    h = int(data[0])
    w = int(data[1])

    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):
import sys

while 1:
    H,W = map(int, raw_input().split())

    if H == 0 and W == 0:
        break

    for i in range(H):
        for j in range(W):
            if j == W-1:
                print "
            elif i == 0 or i == H-1 or j == 0:
                sys.stdout.write("
            else:
                sys.stdout.write(".")

        if i == H-1:
            print ""

Solution (Python):
def rect(h, w):
    s = '
    while h > 1:
        print(s)
        s = '
        h -= 1
    print('
    print()
    return

while True:
    n = list(map(int, input().split()))
    H = n[0]
    W = n[1]
    if (H == 0 and W == 0):
        break
    rect(H, W)

Solution (Python):
a = []
while True:
    d = list(map(int,input().split()))
    if d == [0,0]:
        break
    a.append(d)

for H,W in a:
    print('
    for i in range(0,H-2):
        print('
    print('
    print('')

Solution (Python):
while True:
  hw = [int(x) for x in input().split()]
  h, w = hw[0], hw[1]

  if h == 0 and w == 0:
    break
  for hh in range(h):
    for ww in range(w):
      if hh == 0 or hh == h - 1 or ww == 0 or ww == w - 1:
        print('
      else:
        print('.', end = '')
    print('')
  print('')

Solution (Python):
while True:
    data = map(int, raw_input().split())
    if data[0] == 0 and data[1] == 0:
        break
    else:
        for i in range(data[0]):
            if i == 0 or i == data[0]-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):
        s=""
        for j in range(W):
            if i==0 or i==H-1:
                s+="
            elif j==0 or j==W-1:
                s+="
            else:
                s+="."
        print(s)
    print("")

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

Solution (Python):

import math

def PF(a):
    for k in range(len(a)):
        area = ""
        H = int(a[k].split(" ")[0])
        W = int(a[k].split(" ")[1])
        if H == 0 and W == 0:
            break
        for j in range(H):
            if j == 0 or j == (H-1):
                for i in range(W):
                    area += "
            else:
                area = "
                for i in range(1,W-1):
                    area += "."
                area += "
            print(area)
            area = ""
        print("")

if __name__=="__main__":
    a = []
    for i in range(300):
        a.append(input())
        if a[i] == "0 0":
            break
    PF(a)

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

Solution (Python):
while True:
    

    l = input().split()
    h = int(l[0])
    w = int(l[1])
    
    if h == 0 and w == 0:
        break
    
    element = h*(w+1)

    for i in range(element):
        if (i+1)%(w+1) == 0:
            print("")
            if i == element-1:
                print("")
        elif i+1 < w or i+1 > element-w-1:
            print("
        else:
            if (i+1)%(w+1) == 1 or (i+1)%(w+1) == w:
                   print("
            else:
                   print(".", end="")

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

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

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

Solution (Python):
while True:
    ins = input().split()
    h = int(ins[0])
    w = int(ins[1])
    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):
h= []
w= []
while True:
	a,b= map(int,input().split())
	if(not(a==0 or b==0)):
		h.append(a)
		w.append(b)
	elif(a==b==0):
		break
n= 0
for x in h:
	print('
	if(x>= 3):
		for j in range(x-2):
			if(w[n]>= 3):
				print('
			else:
				print('
	if(x>= 2):
		print('
	n+= 1
	print()

Solution (Python):
while True:
    x = input().split()
    x_int = [int(i) for i in x]

    if x_int[0] == 0 and x_int[1] == 0:
        break
    for i in range(x_int[0]):
        for j in range(x_int[1]):
            if i == 0 or i == x_int[0]-1:
                print('
            else:
                if j == 0 or j == x_int[1]-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):
        if i == 0 or i == H -1:
            print("
        else:
            print("
    print()

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

Solution (Python):

H,W=map(int,input().split())

while not(H==0 and W==0):
    for i in range(0,H):
        for j in range(0,W):
            if i==0 or j==0 or i==H-1 or j==W-1:
                print("
            else:
                print(".",end="")
        print("")
    print("")

    H,W=map(int,input().split())

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

Solution (Python):
if __name__ == "__main__":
	lis = []
	while True:
		a, b = map( int, input().split() )
		if a == b == 0:
			break
		lis.append([a,b])
	for i in lis:
		print('
		for j in range(i[0]-2):
			print('
		print('
		print()

Solution (Python):
while True:                                        
  h, w = [int(n) for n in input().split()]         
  if h == 0 and w == 0:                            
    quit()                                         
                                                   
  for i in range(0, h):                            
    for j in range(0, 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, raw_input().split())
    if H == 0 and W == 0:
        break
    for i in xrange(H):
        if i == 0 or i == H-1:
            print '
        elif W > 1:
            print '
        else:
            print '
    print

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

Solution (Python):
while True:
    [H, W] = [int(x) for x in raw_input().split()]
    if [H, W] == [0, 0]:
        break
    print('
    counter = 0
    while counter < H - 2:
        print('
        counter += 1
    print('

Solution (Python):
while True:
    x = [int(z) for z in input().split(" ")]
    if x[0] == 0 and x[1] == 0: break
    for h in range(0,x[0]):
        for w in range(0,x[1]):
            if h == 0 or h == x[0]-1:
                print("
            elif w == 0 or w == x[1]-1:
                print("
            else:
                print(".", end="")
        print("\n", end="")
    print("")

Solution (Python):
while True:
    a,b=map(int, input().split())
    if a == 0 and b == 0:
        break
    if a == 1:
        print("
    elif a == 2:
        print(("
    else:
        print("
        print((("
        print("

Solution (Python):
matrix = []
while True:
    values = input()
    if '0 0' == values:
        break
    matrix.append([int(x) for x in values.split()])

for height, width in matrix:
    for i in range(height):
        if 0 == i or height - 1 == i:
            print('
        else:
            print('{0}{1}{2}'.format('
    print()

Solution (Python):
while True:
    H, W = [int(x) for x in input().split(" ")]

    if H == 0 and W == 0: exit()

    fill = (["." for x in range(W)])
    fill[0] = "
    fill[len(fill) - 1] = "

    for i in (range(H - 1)):
        if i == 0:
            print("
        elif i == H - 1:
            print("
        else:
            print("".join(fill))

    print("
    print("")

Solution (Python):
if __name__ == '__main__':
    while True:
        data = [int(x) for x in input().split(' ')]
        H = data[0]
        W = data[1]

        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

for i in sys.stdin.readlines()[:-1]:
    h,w = map(int,i.strip().split())
    print("
    for i in range(h-2):
        print("
    if h > 1:
        print("
    print()

Solution (Python):
import sys

for i in sys.stdin.readlines()[:-1]:
    h,w = map(int,i.strip().split())
    print("
    for i in range(h-2):
        print("
    if h > 1:
        print("
    print()

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

Solution (Python):
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    print("\n".join(["".join(["

Solution (Python):
while(True):
	H,W=list(map(int,input().split()))
	if H==0 and W==0:
		break
	top=""
	for i in range(W):
		top+="
	top+="\n"
	mid="
	for i in range(W-2):
		mid+="."
	mid+="
	s=top
	for i in range(H-2):
		s+=mid
	s+=top
	print(s)