Given an ASCII art hexagon as input, output one whose sides are all one unit longer.
_____
____ / \
/ \ / \
/ \ / \
\ \ => \ \
\ / \ /
\____/ \ /
\_____/
The input hexagons will have 180 degree symmetry, but otherwise the sides can be all different lengths. Above, the side lengths (2, 4, 3) get enlarged to (3, 5, 4). The side lengths will be nonzero.
The hexagons are made of underscores _
, slashes /
, and backslashes \
. Note that of the horizontal edges (made with underscores), the top edge is on its own line but the bottom edge is not.
I/O
I'm going to be a stickler and require ascii-art formatting here: the input and output should be a string with newlines representing the image, not a list of lines. Of course, your code may print each line in turn to produce the image, or read STDIN a line a time for input if your language can do that.
Details
The input may include an optional trailing newline if you wish, but will otherwise have no empty lines. You can choose to either have no trailing spaces in the input, or spaces to pad each line to the same length (that of the longest line).
The output should be flush with the left edge of the screen, like the input. You may have extra newlines above and below as well as trailing spaces.
Test cases
Input followed by output.
_
/ \
\_/
__
/ \
/ \
\ /
\__/
____
/ \
/ \
\ \
\ /
\____/
_____
/ \
/ \
/ \
\ \
\ /
\ /
\_____/
_
/ \
/ /
/ /
/ /
/ /
\_/
__
/ \
/ \
/ /
/ /
/ /
/ /
\ /
\__/
Leaderboard
<iframe src="https://xmikee1.github.io/ppcg-leaderboard/?id=185760" width="100%" height="100%" style="border: none;">Oops, your browser is too old to view this content! Please upgrade to a newer version of your browser that supports HTML5.</iframe><style>html,body{margin:0;padding:0;height:100%;overflow:hidden}</style>
IEnumerable
of characters? \$\endgroup\$