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):
lst = []
while True:
    a = list(map(int, input().split()))
    if a[0] == a[1] == 0:
        break
    else:
        lst.append(a)
for i in range(len(lst)):
    for y in range(lst[i][0]):
        for x in range(lst[i][1]):
            if (y == 0 or x == 0 
                    or y == lst[i][0] - 1 or x == lst[i][1] - 1):
                print("
            else:
                print(".", end="")
        print()
    print()

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

Solution (Python):
def main():
  while True:
    h, w = map(int, input().split(' '))
    if h == 0 and w == 0:
      exit()
    
    for i in range(h):
      if i == 0 or i == (h-1):
        print('
      else:
        print('
    print('')
    
  
if __name__ == "__main__":
  main()

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 j in range(h):
        for i in range(w):
            if i == 0 or j == 0 or i == w-1 or j == h-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 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 = [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:
        break
    else:
        for i in range(h):
            if i == 0:
                print('
            elif i == (h - 1):
                print('
                print()
            else:
                print('

Solution (Python):
while(True):
    h, w = (int(x) for x in input().split())
    if (h == 0) and (w == 0):
        break;
    for j in range(w):
        print('
    print('')
    for i in range(h - 2):
        print('
        for j in range(w - 2):
            print('.', end = '')
        print('
    for j in range(w):
        print('
    print('')
    print('')

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

Solution (Python):
s_list = list()

while True:
    h,w = map(int,input().split())
    s_pair = [h,w]
    if s_pair == [0,0]:
        break
    s_list.append(s_pair)

for pair in s_list:
    for h in range(pair[0]):
        if h == 0 or h == pair[0]-1:
            for w in range(pair[1]):
                print('
        else:
            print('
            for w in range(1,pair[1]-1):
                print('.', end='')
            print('
        print('')
    print('')

Solution (Python):

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

    for row in range(h):
        if row == 0 or row == 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):
    if i == 0:
      print("
    elif 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 j in range(h-2):
        print("
    print("
    print()

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

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

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

Solution (Python):

import sys






min=1000000
max=-1000000
total=0


while(1):
    tmp = input().split()
    h,w = list(map(lambda a: int(a), tmp))
    if((h==0)and(w==0)):
        sys.exit()
    for i in range(h):
        tmp=""
        for j in range(w):
            if((i==h-1)or(i==0)or(j==w-1)or(j==0)):
                tmp+="
            else:
                tmp+="."
        print(tmp)
    print("")

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

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

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

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

Solution (Python):
def frame(h,w):
    for height in range(h):
        for width in range(w):
            if 0 < height < h-1 and 0 < width < w-1:
                print('.',end='')
            else:
                print('
        print()
    print()

hws = []
while True:
    hw = list(map(int,input().split()[:2]))
    if hw[0] == hw[1] == 0:
        break
    hws.append(hw)

for hw in hws:
    frame(hw[0],hw[1])

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

Solution (Python):
while True:
    a, b = map(int, input().split())
    if a == b == 0:
        break
    for i in range(a):
        if i == 0 or i == (a-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 h == 0 and w == 0:
        break
    print("
    for i in range(h-2):
        print("
    print("
    print()

Solution (Python):
H = []
W = []

while True:
    h, w = map(int, input().split())
    if h == w and h == 0:
        break
    H.append(h)
    W.append(w)

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

Solution (Python):
while True:
    a,b = map(int, input().split())

    if a == 0 and b == 0: break

    for i in range(a):
        for j in range(b):
            if i==0 or i==a-1 or j==0 or j==b-1:
                print("
            else:
                print(".", end="")
        print()
    print()

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

Solution (Python):
A = []
H, W = map(int, input().split())
while H != 0 or W != 0:
    A.append([H,W])
    H, W = map(int, input().split())
for i in range(len(A)):
    print('
    for j in range(1, A[i][0]-1):
        print('
    print('
    print('')

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

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

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

Solution (Python):
import sys
input = sys.stdin.readline

while True:
	H, W = map(int, input().split())
	if (not H) and (not W):
		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
    else:
        print('
        for _ in range(h-2):
            print('
        print('

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

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):
a=[]
b=[]
while(True):
    x,y = map(int,input().split())
    if(x==0 and y==0):
        break
    a.append(x)
    b.append(y)
for qq in range(len(a)):
    for qqq in range(a[qq]):
        for qqqq in range(b[qq]):
            if(qqq == 0 or qqq == a[qq]-1 or qqqq ==0 or qqqq == b[qq]-1):
                print("
            else:
                print(".",end="")
        print("")
    print("")

Solution (Python):
while True:
    a,b=map(int,input().split())
    if a==b==0:
        break
    else:
        print("
        for i in range(a-2):
            print("
            print("."*(b-2), end="")
            print("
        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("
            elif j==0 or j==w-1:
                print("
            else:
                print(".", end="")
        print()
    print()

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

Solution (Python):
while 1:
    H,W=map(int,input().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:
    a,b=map(int,input().split())
    if a==0 and b==0:
        break
    print('
    for i in range(a-2):
        print("
        for j in range(b-2):
            print('.',end='')
        print("
    print('
    print()

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

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):
answer = []

while True:
    H, W = list(map(int, input().split()))

    if H == W == 0:
        break
    else:
        for i in range(H):
            if (i == 0) or (i == (H - 1)):
                answer.append("
            else:
                answer.append("

    answer.append("")

[print(answer[i]) for i in range(len(answer))]

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):
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    else:
        print("
        for _ in range(H-2):
            print("
        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:
  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=(int(x) for x in input().split())
while H!=0 or W!=0:
    for i in range(H):
        if i==0 or i==H-1:
            print("
        else:
            print("
    H,W=(int(x) for x in input().split())
    print("")

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

Solution (Python):
x,y=[int(x) for x in input().split()]
print("
for i in range(x-2):
  print("
print("

while True:
  x,y=[int(x) for x in input().split()]
  print()
  if x==0 and y==0:
    break
  else:
    print("
    for i in range(x-2):
      print("
    print("

Solution (Python):
for _ in range(10000):
    h, w = map(int, input().split())

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

    for i in range(h):
        l = ""
        for j in range(w):
            if i == 0:
                l += '
            elif i == (h - 1):
                l += '
            else:
                if j == 0:
                    l += '
                elif j == (w - 1):
                    l += '
                else:
                    l += '.'
        print(l)
    print()

Solution (Python):
count = 0

while True:
    H, W = map(int, input().split())

    if H + W == 0:
        break

    for hi in range(H):
        if hi == 0 or hi == H - 1:
            print("
        else:
            for wi in range(W):
                if wi == 0 or wi == 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
    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
    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 == 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):
while True:
    a,b=map(int,input().split())
    if a*b==0:
        exit()
    for i in range(a):
        if i==0 or i==a-1:
            print("
        else:
            print("
    print()

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

    print("
    print("")

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

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

    if 0 == H == W:
        break

    f_and_l_str = ''
    mid_str = ''
    for i in range(W):
        f_and_l_str += '
        if i == 0 or i == (W - 1):
            mid_str += '
        else :
            mid_str += '.'
    
    for i in range(H):
        if i == 0 or i == (H - 1):
            print(f_and_l_str)
        else :
            print(mid_str)

    print()

Solution (Python):
import sys
import itertools
import math



read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

while 1:
    H, W = map(int, readline().split())
    if H == 0 and W == 0:
        break
    else:
        for i in range(H):
            if i==0 or i==H-1:
                Y = '
                print(Y)
            else:
                Y='.'*W
                YY='
                print(YY)
    print()

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

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

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

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

Solution (Python):
li = []
while True:
    li.append(list(map(int, input().split())))
    if li[-1] == [0,0]:
        li.pop()
        break
for l in li:
    print('
    for i in range(l[0]-2):
        print('
    print('
    print('')

Solution (Python):
while True:
    h, w = map(int, input().split())
    
    if h == 0 and w == 0:
        break
    else:
        pass
    
    for i in range(h):
        for j in range(w):
            
            if i == 0 or i == h - 1:
                
                print("
                
            else:
                
                if j == 0:
                    print("
                elif j == 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
	print("
	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:
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        break
    print("
    for i in range(a - 2):
        print("
        print("." * (b - 2), end = "
    print("
    print()

Solution (Python):
def printRectangle(h, w) : 
    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('')
for j in range(30):
    h, w = map(int, input().split())
    if h == 0 and w == 0:
        break
    else:
        printRectangle(h, w)

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

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

Solution (Python):
while True:
    H , W = map(int,input().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=input().split()
    H=int(H)
    W=int(W)
    if H==0:
        break
    a=''
    b='
    for m in range(W-2):
        b+='.'
    b+='
    for w in range(W):
        a+='
    print(a)
    for i in range(H-2):
        print(b)
    print(a)
    if H==0:
        break
    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 in (0, h - 1):
            print("
        else:
            print("
    print()

Solution (Python):
while True:

    h, w = map(int, input().split())
    sharp = "
    cnt = 1

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

    for i in range(h):

        if cnt == 1 or cnt == h:
            linesharp = sharp * w
            print(linesharp)
        else:
            dot = "." * (w - 2)
            print(f"{sharp}{dot}{sharp}")
        cnt+=1

    print("")

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

    if (H == 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):
for _ in range(100000):
    H,W = map(int, input().split())
    if H+W==0:
        exit()
    W_w = '
    W_f = '
    print(W_f)
    for i in range(H-2):
        print(W_w)
    print(W_f)
    print()

Solution (Python):
while True:
    h, w = map(int, input().split())
    if w == h == 0:
        break
    
    for i in range(h):
        print("
        for j in range(w - 2):
            if i == 0 or i == h - 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("
    s = "
    for _ in range(H-2):
        print(s)
    print("
    print()

Solution (Python):

for i in iter(input, '0 0'):
    height, width = list(map(int, i.split()))
    
    for h in range(height):
        line = ''
        is_vertical_side_line = h == 0 or h == height - 1
        for w in range(width):
            is_horizontal_side_line = w == 0 or w == width - 1
            
            if is_vertical_side_line or is_horizontal_side_line:
                line += '
            else:
                line += '.'
            
        print(line)
    
    print()

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("
        else:
            print("

    print()

Solution (Python):
a = []

while True:
    H, W = map(int, input().split())
    if H != 0 or W != 0:
        a.append([H, W])
    else:
        break

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

Solution (Python):
while True:
    h,w=map(int,raw_input().split())
    if h==0 and w==0:
        break
    for x in range(1,h+1):
        if x==1 or x==h:
            print("
        else:
            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 = map(int, input().split())
    if H == 0 and W == 0:
        quit()
    for h in range(H):
        for w in range(W):
            if h != 0 and \
                h != H-1 and \
                w != 0 and \
                w != W-1:
                print(".",end="")
            else:
                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("
    print()

Solution (Python):
while(1):
    h, w = map(int, input().split())
    if h==0 & w==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
    for i in range(1, h+1):
        if i == 1 or i == h:
            print("
        else:
            print("
    print()

Solution (Python):
def print_rectangle(H, W):
    
    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()



if __name__ == "__main__":

    while(1):

        param = input().split(" ")
        h = int(param[0])
        w = int(param[1])

        if h != 0 and w != 0:
            print_rectangle(h, w)
        else:
            break

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

Solution (Python):
a,b=map(int,input().split())
while a or b:
    print('
    for i in range(1,a-1):
        print('
    print('
    print()
    a,b=map(int,input().split())

Solution (Python):

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

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

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