It seems as of recent, there have been a lot a Jimmys falling to their death, as can be seen here, and here where you were asked to determine if Jimmy would fall. It is time we put a stop to this madness and try to save Jimmy.
Jimmy has three body parts
\ arranged like this
Platforms are represented with
-. Jimmy will fall off their platform iff they have two or more body parts that are not directly above a platform.
/o\ - -------
Jimmy will balance since all their body parts are above a
/o\ ------ ---
Jimmy will balanced since two body parts are above
/o\ -- ---- --
Jimmy will balance even though they are split between two platforms
Jimmy will not balanced since two body parts are not above a platform.
Since my platform supply is running low, I only have platforms with a length of 5, and it is important we use as few as possible.
Your task is to take an input of Jimmys and output a string of platforms which will save all of the Jimmys in the input. Your output must use as few platforms as possible, but each platform must be 5
Note that the rule of the platform being 5
- wide, means that each platform must have a space between them.
---------- is not valid in the output since it will be considered a platform of length 10 and not two platforms of length 5.
/o\ /o\/o\ // input ----- ----- // output
/o\ /o\ ----- -----
/o\ /o\ // same input as above ----- ----- // this is also valid output
/o\ /o\ -----
Standard rules apply.
This is code-golf, may the shortest answer win!