# [Python 3], 371 bytes ```python def f(s,n): for y in range(n): for x in range(n): r=min(x,y,n-x-1,n-y-1);i=4*r*(n-r)-2*r+x+y+2*((n-r-1-x)+(n-r-1-y)*(y+x<n-1))*(y>x);H=(x<n-y-1or x<y)and(x>y-2or x>n-y-2) if i<len(s):c=s[i] elif x+1-(n%2)==y==n//2:c="<>"[n%2] elif(n-2-2*x)*(x+1>n/2)+x==y-1:c="." elif(n-1-2*x)*(x+1>n/2)+x==n-y-1:c="'" else:c="|-"[H] print(c,end=" -"[H]) print() ``` [Try it online!][TIO-lkvstimd] Instead of most other solutions (as far as I can tell), I tried calculating the index into the string. I dug up a post on [StackOverflow] that helped with this, though a lot was just throwing random equations and seeing what they do. I'm rather certain the equations can be golfed further if I'd actually think about what I'm doing. The obvious next step is to replace `- x - 1` with `+~x`, and the similar tricks with inverse. Ungolfed: ```python def function(string: str, number: int): for y in range(number): for x in range(number): is_up_corner = x + (number - 2 - 2 * x) * (x + 1 > number / 2) == y - 1 is_down_corner = x + (number - 1 - 2 * x) * (x + 1 > number / 2) == number - y - 1 is_middle = x + 1 - (number % 2) == y == number // 2 # is_left_corner = y + (number - 2 * y) * (y > number / 2) == x + 1 # is_right_corner = y + (number - 1 - 2 * y) * (y > number / 2) != number - x - 1 rounds = min(x, y, number - x - 1, number - y - 1) # sum of increments per round and fix for overcounting index = 4 * rounds * (number - rounds) - 2 * rounds index += x # east increment index += y # south increment index += 2 * (number - rounds - 1 - x) * (y > x) # west index += 2 * (number - rounds - 1 - y) * (y + x < number - 1) * (y > x) # north is_horizontal = ((x < y or x < number - y - 1) and (x > y - 2 or x > number - y - 2)) if index < len(string): character = string[index] elif is_middle: character = "<>"[number % 2] elif is_up_corner: character = "." elif is_down_corner: character = "'" elif is_horizontal: character = "-" else: character = "|" print(character, end='-' if is_horizontal else ' ') print() ``` [Python 3]: https://docs.python.org/3/ [stackoverflow]: https://stackoverflow.com/a/18786566/11298075 [TIO-lkvstimd]: https://tio.run/##bZDBS8MwFMbP618RCtKkTRzNpoyt6cGDDG@Ct@GhrKkL615KumEC/u81qdM58RLe@33fy/d4nTvuNMwWnRmGWjaowT0FsoxQow1ySAEyFbxJPLIR2r8QGXFQgC11FJhluX8dy8lKiXlqUgzMEMZTk9nMZTzFAbCcWZKdK0dS7DJbgB8KZWnJai1wAP6fkFg4UkGNbekYD30ZFE5CtmqQKloJuCfLreg36jVQ2Xpus5xhuOFECCcETKfcO@KijDce/tj8EtyvZ32yHyhhyklm/QTLg/s2/uXL//GNOwZncnb2MnQfLN6sx4zOKDjiLZVQixiNOCz@hckQLqouF51TtPBHnTQ46aHay8roE9QJVSSanEeiyIugdd3KQwUJnZPoW7kW7i9CUF528vmktvsHo9/hUdun06HrE3p37epaWfUSdEJnZPgE "Python 3 – Try It Online"