39 lines
1.0 KiB
Python
Executable File
39 lines
1.0 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
import sys
|
|
|
|
text = sys.stdin.readline().strip()
|
|
segments = []
|
|
while len(text) > 61:
|
|
ptr = 61
|
|
while ptr > 0 and text[ptr] != " ":
|
|
ptr -= 1
|
|
segments.append(text[:ptr])
|
|
text = text[ptr:].lstrip()
|
|
segments.append(text)
|
|
|
|
max_width = max([len(s) for s in segments])
|
|
lines = ["\u2502 {0:{1}} \u2502".format(s, max_width) for s in segments]
|
|
text_half = ["", "\u256D\u2500" + "\u2500"*max_width + "\u2500\u256E"] + lines + ["\u2570\u2500" + "\u2500"*max_width + "\u2500\u256F"]
|
|
if len(text_half) > 5:
|
|
text_half.pop(0)
|
|
horse_half = [
|
|
" ./|,,/| ",
|
|
" < o o) ",
|
|
" <\ ( | \u2500\u2500",
|
|
" <\\\ |\ | ",
|
|
" <\\\\\ |(__) ",
|
|
"<\\\\\\\ | "
|
|
]
|
|
|
|
for i in range(max(len(horse_half), len(text_half))):
|
|
if horse_half[i][-1] == '\u2500' and text_half[i][0] == '\u2502':
|
|
text_half[i] = '\u2524' + text_half[i][1:]
|
|
if i < len(horse_half):
|
|
sys.stdout.write(horse_half[i])
|
|
else:
|
|
sys.stdout.write(" " * len(horse_half[0]))
|
|
if i < len(text_half):
|
|
sys.stdout.write(text_half[i])
|
|
sys.stdout.write("\n")
|
|
|