Result

AC

Duration

1081ms

Code [DL]

process.stdin.on('data',s=>{[h,w]=(''+s).split(`
`),a='*'[r='repeat'](w)+`
`,console.log(a+`*${' '[r](w-2)}*
`[r](h-2)+a)})

stdin

19
72

stdout

************************************************************************
*                                                                      *
*                                                                      *
*                                                                      *
*                                                                      *
*                                                                      *
*                                                                      *
*                                                                      *
*                                                                      *
*                                                                      *
*                                                                      *
*                                                                      *
*                                                                      *
*                                                                      *
*                                                                      *
*                                                                      *
*                                                                      *
*                                                                      *
************************************************************************

stderr