Result

AC

Duration

1022ms

Code [DL]

with x(i,j)as(select v+0 i,substr(v,instr(v,'
')+1)j from i),c(k)as(values(1)union select k+1 from c limit(select i from x))select printf('*%.'||(j-2)||'c*',case when(k=1 or k=i)then'*'else' 'end)from x,c

stdin

40
42

stdout

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

stderr