Result: Accepted
Time: 4ms
Memory: 1092kB
#include<stdio.h>
int main(void){
int a;
char b;
while(scanf("%d %c",&a,&b)!=EOF){
int i,j;
for(i=0;i<(a+4);++i){
for(j=0;j<(a*4+7);++j){
if(i==0||i==(a+3))printf("-");
else if(j==0||j==(a*4+6))printf("|");
else if((i>1&&i<(a+2))&&(j==2||j==(1+a)||j==(2*a+4)||j==(3*a+3)||j==(3*a+5)||j==(4*a+4)))printf("%c",b);
else if((i==2||i==(a+1))&&(j>(2+a)&&j<(2*a+3)))printf("%c",b);
else if(i==(a/2+2)&&(j>1&&j<(2+a)))printf("%c",b);
else if((i>1&&i<(a+2))&&((i+j==(2*a+4))||(j-i==(2*a+2))))printf("%c",b);
else if(i==(a+1)&&j>(3*a+4)&&j<(4*a+5))printf("%c",b);
else printf(" ");
if(j==(a*4+6))printf("\n");
}
}}
return 0;
}