Jimmy has had a busy last week with all these platforms and ropes, and poor Jimmy doesn't even have legs or feet to stand on!
Your job is to take a string containing multiple Jimmys and give them legs and shoes!
Get input in the form of a Jimmy String
Jimmy String => /o\ /o\ /o\
containing only /o\
and
give each Jimmy in the input a pair of feet that look like this:
/o\
_/ \_
Turn the inputed floating head Jimmy string into Jimmy with feet string, like so:
// Input
/o\ /o\ /o\
// Output
/o\ /o\ /o\
_/ \_ _/ \_ _/ \_
If 2 Jimmys are close together they must move over to make room, Jimmys will always move towards the right to make room for other Jimmys.
// Input
/o\/o\
// Output
/o\ /o\
_/ \__/ \_
Other Jimmys that are further away must not be moved unless necessary
// Input
/o\/o\ /o\
// Output
/o\ /o\ /o\
_/ \__/ \_ _/ \_
// Input
/o\/o\ /o\
// Output
/o\ /o\ /o\
_/ \__/ \__/ \_
Standard rules and loopholes apply,
This is code-golf, so may the shortest answer win.
/o\<sp>/o\<sp><sp><sp><sp><sp><sp><sp><sp>/o\/o\
, my current implementation fails because it moves the last two Jimmies towards the left instead of right.. All of your test cases succeed, though. \$\endgroup\$