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