You are given a string of terrain, with molehills and mountains:
/\
/ \
_/\__ / \
___/ \_/ \_
____/\___/ \___
Your job is to replace every molehill in the string with an equivalent mountain centered in the same column. The rest of the string must be unaffected. This may require additional lines at the beginning of the string.
A molehill consists of adjacent columns where the terrain goes up, immediately followed by adjacent columns where the terrain goes down. The shortest side must be exactly one column wide.
These are all molehills:
_____/\______
/\________
__/
________/\
\__
\ /
\ /
\ /
\ /
\/\_/
These are not molehills:
/\
___/ \______
___
_____/ \___
____ _______
\/
A mountain is like a molehill, but the shortest side is four lines high instead of one.
Examples
/\
/ \
-> / \
____/\____ _/ \_
/\
/ \
/ \
__ -> / \__
_ /\__/ __/
\___/
/\
/ \
-> / \
/\ /\/ \
_/ \__/\_____ _/ \_
_ _ _ _
\ / \ /\ /
\ / \ / \ /
\ / \ / \ /
\ / -> \/ \/
\ /
\ /
\/\/
/\ /\
/ \ / \
/ \ / \
_ -> _/ \/ \
\ \
\ \
\/\______/\_______ \_
/\ /\ /\
/ \ /\ / \ / \
_/\__ / \ -> / \ / \ / \
___/ \_/ \_ / \ __/ \_/ \_
____/\___/ \___ _/ \/ \___
Additional Rules
- Standard loopholes are forbidden.
- Input and output can be in any reasonable format.
- You may assume the presence or absence of trailing whitespace in the input string.
- There will always be enough space in the sides of the string as well as between molehills for any mountains you might need.
- If replacing the molehills with mountains creates additional molehills, you do not need to turn those molehills into mountains.
- The terrain cannot go both up and down in the same column. If this happens, the terrain does not move.
- If a particular column does not become part of a mountain, its height must remain unchanged.
This is code-golf, so the shortest answer in bytes wins.
/, \, _
, so how could it possibly go up and down at the same time? \$\endgroup\$