Result

AC

Duration

1683ms

Code [DL]

import java.util.*;interface A{static void main(String[]a){int i,j,w,h;Scanner s=new Scanner(System.in);h=s.nextInt();w=s.nextInt();String q="*",p=" ";for(i=0;i<w;i++)System.out.print(q);System.out.println();for (i=0;i<h-2;i++){System.out.print(q);for (j=0;j<w-2;j++)System.out.print(p);System.out.println(q);}for (i=0;i<w;i++)System.out.print(q);System.out.println();}}

stdin

78
54

stdout

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

stderr

strace