In this simple but fun challenge, you were asked to determine if Jimmy would fall of their platform. 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.
Your task is to write a program that takes a platform as a lengthed container containing only
s (e.g. a string) and outputs the number of Jimmys that can be placed on the platform such that none of them will fall and none of them will overlap. A Jimmy may have one of their body parts to the left of the beginning of the string or the right of the end of the string.
This is code-golf so answers are scored in bytes with fewer bytes being the aim.
- - - - - -- -- -- ---- - -- -- ------- -
0 0 1 1 2 2 2 3