fork download
  1. h = int(input())
  2. w = int(input())
  3. for i in range(h):
  4. if(i==0 or i==h-1):
  5. print("#"*w)
  6. else:
  7. print("#"+" "*(w-2)+"#")
  8.  
Success #stdin #stdout 0.1s 14152KB
stdin
5
8
stdout
########
#      #
#      #
#      #
########