Problem:


Flag

  AHK Education, the educational program section of Aizu Broadcasting Cooperation, broadcasts a children’s workshop program called "Let's Play and Make." Today’s theme is "Make your own flag." A child writes his first initial in the center of their rectangular flag.

Given the flag size and the initial letter to be placed in the center of it, write a program to draw the flag as shown in the figure below.

+-------+
|.......|
|...A...|
|.......|
+-------+

  The figure has "A" in the center of a flag with size 9 (horizontal) &times; 5 (vertical).

Input

The input is given in the following format.

W H c

The input line provides the flag dimensions W (width) and H (height) (3 ≤ W,H ≤ 21), and the initial letter c. Both W and H are odd numbers, and c is a capital letter.
  

Output

Draw the flag of specified size with the initial in its center using the following characters: "+" for the four corners of the flag, "-" for horizontal lines, "|" for vertical lines, and "." for the background (except for the initial in the center).
  

Sample Input 1

3 3 B

Sample Output 1

+-+
|B|
+-+

Sample Input 2

11 7 Z

Sample Output 2

+---------+
|.........|
|.........|
|....Z....|
|.........|
|.........|
+---------+



Sample input:
3 3 B


Sample output:
+-+
|B|
+-+

Submission status: Wrong Answer

Solution code:
w, h, a = input().split()
w, h= int(w), int(h)
for i in range(h):
    if i in {0, h -1}:print("+" + "-" * (w - 2) + "+")
    else:print("|" + "-" * ((w - 2) // 2) + a + "-" * ((w - 2) // 2) + "|" if i == h // 2 else "|" + "-" * (w - 2) + "|")

Submission status: Accepted

Solution code:
w, h, a = input().split()
w, h= int(w), int(h)
for i in range(h):
    if i in {0, h -1}:print("+" + "-" * (w - 2) + "+")
    else:print("|" + "." * ((w - 2) // 2) + a + "." * ((w - 2) // 2) + "|" if i == h // 2 else "|" + "." * (w - 2) + "|")

Submission status: Accepted

Solution code:
W, H, c = input().split()
W, H = int(W), int(H)
for i in range(H):
    if i == 0 or i == H - 1:
        print("+" + "-" * (W-2) + "+")
    elif i == H//2:
        line = list(("|" + "." * (W-2) + "|"))
        line[W//2] = c
        print("".join(line))
    else:
        print("|" + "." * (W-2) + "|")

Submission status: Accepted

Solution code:
w, h, c = input().split()
w = int(w)
h = int(h)
end = "+" + "-" * (w - 2) + "+"
center = "|" + "." * ((w - 3) // 2) + c + "." * ((w - 3) // 2) + "|"
common = "|" + "." * (w - 2) + "|"
for i in range(h):
  if i in (0, h - 1):
    print(end)
  elif i == h // 2:
    print(center)
  else:
    print(common)

Submission status: Accepted

Solution code:
W,H,c=map(str,input().split())
W,H=int(W),int(H)

for i in range(H):
    if i==0 or i==H-1:
        print("+"+"-"*(W-2)+"+")
    elif i==H//2:
        j=(W-2)//2
        print("|"+"."*j+c+"."*j+"|")
    else:
        print("|"+"."*(W-2)+"|")

Submission status: Accepted

Solution code:
W, H, c = input().split()
W = int(W)
H = int(H)
for i in range(H) :
    for j in range(W) :
        if (i == 0 and j == 0) or (i == 0 and j == W-1) or (i == H-1 and j == 0) or (i == H-1 and j == W-1) :
            print('+', end='')
        elif i == 0 or i == H-1 :
            print('-', end='')
        elif j == 0 or j == W-1 :
            print('|', end='')
        elif i == ((H-1)//2) and j == ((W-1)//2) :
            print(c, end='')
        else :
            print('.', end='')
    print()

Submission status: Accepted

Solution code:
w, h, c = input().split()
w, h = int(w), int(h)
for y in range(h):
    if y == 0 or y == h - 1:
        print('+' + '-' * (w - 2) + '+')
        continue
    for x in range(w):
        if x == 0:
            print('|', end='')
        elif x == w - 1:
            print('|')
        elif y == (h - 1) // 2 and x == (w - 1) // 2:
            print(c, end='')
        else:
            print('.', end='')

Submission status: Accepted

Solution code:
lines = input().split()
w = int(lines[0])
h = int(lines[1])
c = lines[2]

for i in range(h):
    for j in range(w):
        if i == 0 or i == (h - 1):
            if j == 0 or j == (w - 1):
                print("+", end="")
            else:
                print("-", end="")
        else:
            if i == (h // 2) and j == (w // 2):
                print(c, end="")
            elif j == 0 or j == (w - 1):
                print("|", end="")
            else:
                print(".", end="")
    print("")

Submission status: Accepted

Solution code:
W,H,c = input().split()
W,H = int(W),int(H)
for i in range(H):
    for j in range(W):
        if (j,i) == (0,0) or (j,i) == (0,H-1) or (j,i) == (W-1,0) or (j,i) == (W-1,H-1):
            print('+',end='')
        elif j in (0,W-1):
            print('|',end='')
        elif i in (0,H-1):
            print('-',end='')
        elif (j,i) == ((W-1)//2,(H-1)//2):
            print(c,end='')
        else:
            print('.',end='')
    print()

Submission status: Accepted

Solution code:
W, H, c = input().split(); W = int(W); H = int(H)
print("+" + "-"*(W-2) + "+")
for i in range((H-3)//2):
    print("|" + "."*(W-2) + "|")
print("|" + "."*((W-3)//2) + c + "."*((W-3)//2) + "|")
for i in range((H-3)//2):
    print("|" + "."*(W-2) + "|")
print("+" + "-"*(W-2) + "+")

Submission status: Accepted

Solution code:
W,H,c = input().split()
W = int(W)
H = int(H)

for i in range(H):
    for j in range(W):
        if (i == 0 or i == H-1) and (j == 0 or j == W-1):
            print("+", end="")
        elif i == 0 or i == H-1:
            print("-", end="")
        elif j == 0 or j == W-1:
            print("|", end="")
        elif 2*i == H-1 and 2*j == W-1:
            print(c, end="")
        else:
            print(".", end="")
    print("")

Submission status: Accepted

Solution code:
w,h,c=input().split()
w=int(w)
h=int(h)
a=""
d=""
d_e=""
cnt=2

for i in range(w-2):
    cnt+=1
    a+="-"
    d+="."
    if cnt!=w//2+2:
        d_e+="."
    else:
        d_e+=c
    
print("+"+a+"+")

cnt=2

for j in range(h-2):
    cnt+=1
    if cnt!=h//2+2:
        print("|"+d+"|")
    else :
        print("|"+d_e+"|")
print("+"+a+"+")

Submission status: Accepted

Solution code:
W,H,c = input().split()
W = int(W)
H = int(H)
for i in range(H):
    for j in range(W):
        if i == 0 and j == 0 or i == 0 and j == W-1 or \
           i == H-1 and j == 0 or i == H-1 and j == W-1:
            print("+", end="")
        elif i == 0 or i == H-1:
            print("-", end="")
        elif j == 0 or j == W-1:
            print("|", end="")
        elif i == H//2 and j == W//2:
            print(c, end="")
        else:
            print(".", end="")
    print()

Submission status: Accepted

Solution code:
w, h, c = input().split()
w = int(w)
h = int(h)

flag = "+"
for _ in range(w-2):
    flag += "-"
flag += "+"
print(flag)

for i in range(1, h-1):
    flag = "|"
    if i != h // 2:
        for _ in range(w-2):
            flag += "."
        flag += "|"
    else:
        for j in range(1, w-1):
            if j != w // 2:
                flag += "."
            else:
                flag += c
        flag += "|"
    print(flag)

flag = "+"
for _ in range(w-2):
    flag += "-"
flag += "+"
print(flag)

Submission status: Accepted

Solution code:
s=list(input().split())
w=int(s[0])
h=int(s[1])
for i in range(h):
    if(i==0 or i==h-1):
        print("+"+"-"*(w-2)+"+")
        continue
    if(i==(h-1)//2):
        print("|"+"."*((w-2)//2)+s[2]+"."*((w-2)//2)+"|")
        continue
    print("|"+"."*(w-2)+"|")

Submission status: Accepted

Solution code:
n,m,h = map(str,input().split())
ans = []
n = int(n)
m = int(m)
for i in range(m):
  ss = ""
  for j in range(n):
    if i == m//2 and j == n//2:ss += h
    elif (i == 0 or i == m-1) and (j == 0 or j == n-1):ss += "+"
    elif i == 0 or i == m-1:ss += "-"
    elif j == 0 or j == n-1:ss += "|"
    else:ss += "."
  ans.append(ss)

for i in range(m):print("".join(ans[i]))

Submission status: Accepted

Solution code:
w,h,c=input().split(" ")
w=int(w)
h=int(h)
print("+"+"-"*(w-2)+"+")
for i in range(h-2):
    if i*2==h-3:
        print("|"+"."*((w-3)//2)+c+"."*((w-3)//2)+"|")
    else:
        print("|"+"."*(w-2)+"|")
print("+"+"-"*(w-2)+"+")