[Question]
  [
Platforms are stretches of `-` characters separated by one or more  characters.
For example:
```
------ --    ------ -
```
The above has 4 platforms sizes 6, 2, 6 and 1.
Platforms that are not supported will fall. To be supported platforms need Jimmies.
Jimmies look like this:
```
\o/
```
They are three units wide. Don't ask me what supports Jimmies.
Jimmies go under platforms to support them:
```
------------------
\o/  \o/  \o/  \o/
```
Each platform has a "center" of mass which is the average position of all its `-`s. (Or the average of the start and end.)
A platform is supported by Jimmies if its center of mass is between two points of the platform above a Jimmy or exactly above part of a Jimmy.
For example:
```
-----
 \o/
```
The above platform is supported because the center of mass is in a place the Jimmy is touching.
```
----------------
  \o/        \o/
```
The above platform is also supported because its center of mass is between the two Jimmies.
```
----
 \o/
```
In the above example the center of mass is between the Jimmy's hand and the Jimmy's head and thus the platform is supported by that Jimmy.
The following platform is not supported:
```
----
  \o/
```
This is because its center of mass is not directly above any part of the Jimmy and there is no Jimmy to the left.
A Jimmy can help support multiple platforms:
```
------- -------------
\o/   \o/           \o/
```
Your task is to take as input platforms (consisting only of `-`s and s). And output the minimum number of Jimmies required to support all the platforms given.
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so answers will be scored in bytes with fewer bytes being better.
## Test cases
Each line has the input, `>` and then the output. Below I have added one way to place the Jimmies to support the platforms. This is neither part of the input nor output, it's just there for your convenience.
```
-------------------------------- > 1
              \o/
--------------- ---------------- > 2
      \o/              \o/
- ---------------------------- - > 2
\o/                          \o/
-  --------------------------- - > 3
\o/\o/                       \o/
--- - ------------------------ - > 3
\o/ \o/                      \o/
- ------------- -------------- - > 3
\o/           \o/            \o/
--------------- - -------------- > 3
      \o/       \o/          \o/
- - -  ------------------------- > 3
\o/ \o/           \o/
```
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~18 13~~ 10 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
ḲẈṣ0H«1§ĊS
```
A monadic Link that accepts a list of characters and yields an integer.
**[Try it online!](https://tio.run/##y0rNyan8///hjk0Pd3U83LnYwOPQasNDy490Bf9/uHvL4fZHTWv@/9clALjQ@AqYChTw6VcAKVAgoABEKuA1AZ8bFLA4UgHTkQr43AFVoAsA "Jelly – Try It Online")**
### How?
Jimmies can't help if the gap is greater than one, so the result is the sum of Jimmies required for each section after partitioning at such gaps. In each section, we need one Jimmy per platform minus one Jimmy for every two length-one platforms, since then Jimmies can share the load of these and any intermediate platforms.
```
ḲẈṣ0H«1§ĊS - Link: list of characters, P
Ḳ          - split at spaces
 Ẉ         - length of each -> lengths of platforms with zeros between sections
  ṣ0       - split at zeros -> list of section platform lengths
                               (potentially including phantom empty sections)
    H      - halve (vectorises)
     «1    - minimum with one (vectorises)
       §   - sums
        Ċ  - ceiling (vectorises)
         S - sum
```
[Answer]
# ARM T32 machine code, 32 bytes
```
0003 2000 2102 1e4a bf58 07d1 0fc9 3905
3102 f150 0000 cb04 2a20 d0f4 d8f8 4770
```
Following the [AAPCS](https://github.com/ARM-software/abi-aa/blob/2bcab1e3b22d55170c563c3c7940134089176746/aapcs32/aapcs32.rst), this takes in r0 the address of the input as a null-terminated string *in UTF-32* (if this is not allowed, +2 bytes for `LDMIA` → `LDRB` with writeback or 2 instructions), and returns the number of Jimmies needed in r0.
The problem can be solved by a greedy algorithm, reading the string one character at a time while maintaining some values: \$L\$, the length so far of the current platform or 0 if none; \$Z\$, a flag that is 1 if the current platform is supported at its left end, and 0 otherwise; and \$T\$, the number of Jimmies used so far.
When reading a platform character (`-`), if \$Z\$ is 0, we need to add a Jimmy (incrementing \$T\$) the first time (when \$L\$ is 0); if \$Z\$ is 1 (left-supported), we only need to add a Jimmy if the platform is longer than 1, so increment \$T\$ on the second platform character (when \$L\$ is 1). These cases can be combined: increment \$T\$ if \$L = Z\$. Afterwards, \$L\$ is incremented.
When reading a non-platform character (), the way \$Z\$ is modified is more complicated. For a long platform (\$L \ge 2\$), if the platform is not left-supported, its Jimmy supports only that platform, whereas if it is left-supported, its second Jimmy can be placed at its right end to potentially support a later platform; this means that \$Z\$ remains unchanged. For a short platform (\$L\$ is 1), an existing left-support is enough for it, while if it was not left-supported, then it gets a new Jimmy that can also support a later platform; this means that \$Z\$ is inverted. Finally, if there is no platform between two consecutive non-platform characters (\$L\$ is 0), then any out-hanging Jimmy runs out; \$Z\$ is set to 0. Afterwards, \$L\$ is set to 0. Here is a summary of the way \$Z\$ is changed: $$ \begin{array}{c|ccccc} & 0 & 1 & 2 & 3 & \cdots \\ \hline 0 & 0 & 1 & 0 & 0 & \cdots \\ 1 & 0 & 0 & 1 & 1 & \cdots \end{array} $$
In my program, \$L\$ and \$Z\$ are combined into a single value \$K = 2L - Z - 2\$.  
Then, when reading a platform character (`-`), \$K\$ is increased by 2, and \$T\$ is incremented if \$K\$ changes from -2 to 0 or from -1 to 1, or equivalently, if \$K\$ changes from negative to nonnegative. When reading a non-platform character (), \$K\$ changes as follows: $$ \begin{array}{c|cccc|ccccc} \textrm{Before} & -3 & -2 & -1 & 0 & 1 & 2 & 3 & 4 & \cdots \\ \hline \textrm{After} & -2 & -2 & -2 & -3 & -3 & -2 & -3 & -2 & \cdots \end{array} $$
Assembly:
```
.code 16
.section .text
.syntax unified
.global njimmies
.thumb_func
njimmies:
    movs r3, r0       @ Transfer string address to r3
    movs r0, #0       @ Total number of Jimmies = 0
    movs r1, #2       @ K = 2 (will be changed by the following code before reading the string)
space:
    subs r2, r1, #1   @ Calculate K-1
    it pl             @ If the result is nonnegative...
    lslpl r1, r2, #31 @  shift the low bit of the result into the high bit of r1
    lsrs r1, r1, #31  @ Shift the high bit of r1 into the low bit; all other bits become 0
    subs r1, #5       @ Make the value -4 or -5, and fall through
platform:
    adds r1, #2       @ Add 2 to K
    adcs.w r0, #0     @ Count up one Jimmy if K went from negative to nonnegative
    ldmia r3!, {r2}   @ Load the next character
    cmp r2, #32
    beq space         @ Jump on ' '
    bhi platform      @ Jump on '-'
    bx lr             @ Return on the null terminator
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~21~~ ~~20~~ 19 bytes
```
OḂŒrµ=1EƇṣØ0Ẉ:2SạSḢ
```
[Try it online!](https://tio.run/##y0rNyan8/9//4Y6mo5OKDm21NXQ91v5w5@LDMwwe7uqwMgp@uGth8MMdi/4/3L3lcPujpjX//@sSAFxofAVMBQr49CuAFCgQUAAiFfCagM8NClgcqYDpSAV87gAA "Jelly – Try It Online")
This may or may not be an incredibly stupid way to do it.
Based on the following observation: the best way is to use one Jimmy per platform, unless there are two platforms of length 1 such that all spaces between them are also length 1, in which case they can be connected by Jimmies, saving one Jimmy.
[Answer]
# [C (clang)](http://clang.llvm.org/), 73 bytes
```
c;o;f(*s){for(c=o=1;*s;o=*s++)c=o-*s?*s%5?s[1]%5>0|c:s[1]%2-~c:c;*s=c/2;}
```
[Try it online!](https://tio.run/##lZJdboMwDMffewoLCSlQUEunvjRjvcBu0PHQuUmFxABhqm7r2NHHHKAtQxrdoigf9u9vHGz0Mdmm@7pGmUktXHJOOisEhlkYSJdkFro0nTp8911au2Qv17QJInv5MP/AVXNc@J@4QoZDnC1kVcdpCS/bOBXO5DQBHmxwoVRU0iaCEFqjGY@Wf2NY3u8wjMMwFheGMPwDNhb4c@SxnOHGA2H8gTCWdwdX8lwDUK@5wlLt2ipA4MGimXf92RdgduA1BIrfVabFWe/A7Gxiyml57howV4hZMJe83bd6PnIDNcy18peWYLjtjDiSfS8kKmXfEYkPwiDOT//zQW8MM4Wgp2Qe8zfBTg8GIm2sgyCFokNicuii9SLlBQNaWHZC7Ld3zfKUWt4lX6@Te9cfG0fdB6pJVX@hTrZ7qv3jNw "C (clang) – Try It Online")
-7 byte thanks to ceilingcat!!
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 29 bytes
```
{+/⌈+/¨1⌊2÷⍨0(≠⊆⊢)≢¨⍵⊆⍨' '≠⍵}
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///v1pb/1FPh7b@oRWGj3q6jA5vf9S7wkDjUeeCR11tj7oWaT7qXHRoxaPerSBu7wp1BXWQVO/W2v9pj9omkKuZ61HfVKD2NAV1XVSgAIQoQP0/AA "APL (Dyalog Unicode) – Try It Online")
[Answer]
# [R](https://www.r-project.org/), ~~109~~ ~~93~~ 92 bytes
Or **[R](https://www.r-project.org/)>=4.1, 78 bytes** by replacing two `function` appearances with `\`s.
```
function(x,`+`=strsplit,`?`=sum)?sapply(el(x+"  ")+" ",function(a)pmin(nchar(a)/2,1)?.5)%/%1
```
[Try it online!](https://tio.run/##jY5BCsMgEEX3PcUwEHCIbUihy@BVlFCpYKyogeT01m6yKZrOYpgPbz4vZD1lvbo5mbdjG5e9nGIK0VuTuBQlrAuJqLy3O3tatvUIgFQ28uNNkV@MY25@qVDCcOcjiduDuqEbs2Z4PRmkyy8FFQpaTXBQ8A/1PeG8q@UFNXuo2EPLDSl/AA "R – Try It Online")
Port of [@Jonathan Allan's solution](https://codegolf.stackexchange.com/a/235264/55372).
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 12 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
ð¡€g0¡<Ā>;OîO
```
Port of [*@JonathanAllan*'s Jelly answer](https://codegolf.stackexchange.com/a/235264/52210).
[Try it online](https://tio.run/##yy9OTMpM/f//8IZDCx81rUk3OLTQ5kiDnbX/4XX@///rKoCggi4uAAA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9TVmmvpPCobZKCkn3l/8MbDi181LQm3eDQQpsjDXbW/ofX@f/X@a9LAHCh8RUwFSjg068AUqBAQAGIVMBrAj43KGBxpAKmIxXwuQOqQBcA).
**Explanation:**
```
ð¡             # Split the (implicit) input-string on spaces
               # (`#` doesn't work here if the input lacks any spaces)
  €g           # Get the length of each part
    0¡         # Split this list of integers on 0s
      <        # Decrease each length by 1
       Ā       # Check which values are NOT 0 (0 if 0; 1 if >= 1)
        >      # Increase each by 1 (1 if 0; 2 if >= 1)
         ;     # Halve each (0.5 if 0; 1 if >= 1)
          O    # Sum each inner list
           î   # Ceil each sum
            O  # And sum those together again
               # (after which the result is output implicitly)
```
[Answer]
# [JavaScript (V8)](https://v8.dev/), ~~86~~ 78 bytes
Thanks Johan du Toit for -8
```
x=>(a=.5,x.split`  `.map(p=>p.split` `.map(i=>a+=i?i[1]?1:.5:0,a=~~a+.5)),~~a)
```
[Try it online!](https://tio.run/##hZHRioMwFETf/YqhT4amQXcRlkrsh4jQ4MYli63BBBGW7a9bG7EotnpfDHNPJiPzKxph8lppe2i@uoJ3LU98wVlEW2Z0qewZOLOL0L7miR6lQVE8EXuuTioNs1N4ZNExoILfbmLPIkJofyBdI2pYaawBR@qhnxS7w8bsKMKMvqHxgv6Y0FhzxoLGFv05S4L3/gsaa7lfeM/XWPzl3Btr2ec0NqangyntAsxeGDUMuaOezmKvqGr4rmGo61AzwZ/zGXvva3d6arM0yGI8l7LVMrfyewqEI5BXV1OVkpXVj//YUhTuS@jzHom9/@4O "JavaScript (V8) – Try It Online")
[Answer]
# [Python 3](https://docs.python.org/3/), ~~88~~ ~~81~~ ~~79~~ 77 bytes
```
lambda x:-sum(-sum(min(len(j),2)for j in i.split())//2for i in x.split('  '))
```
[Try it online!](https://tio.run/##hY5BDoIwEEXXcIq/o01EIu40LnHrBdyAljBYSlNKhNNXa1yJKbP4yfy8mTw926ZXe1efrk6WXXUvMR3SYezYJzpSTArFWr7Jed0btCAF2g5akmWcZ1nuW/Lt9G0TIOHcPRuSArtDHFkzvzPShpRlNSOlR3/L40hMN6Etisu5MKY3nqqMKB9Hl65M/LNjCSB0Dw9gBfCJ4IeQA/5IYimJkMcL "Python 3 – Try It Online")
-7 bytes thanks to [EnderShadow8](https://codegolf.stackexchange.com/users/103324/endershadow8) and [movatica](https://codegolf.stackexchange.com/users/86751/movatica).  
-2 bytes thanks to [movatica](https://codegolf.stackexchange.com/users/86751/movatica).  
-2 bytes thanks to [Wheat Wizard](https://codegolf.stackexchange.com/users/56656/wheat-wizard).
Based on [Jonathan Allan](https://codegolf.stackexchange.com/users/53748/jonathan-allan)'s answer. Outputs an integer.
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), 12 bytes
```
--+
--
- ?-?
```
[Try it online!](https://tio.run/##K0otycxLNPz/X1dXm0tXl0tXwV7XHsRTAEMgDaYUwDQY6QIA "Retina – Try It Online")
Reduce all long platforms to length 2, which doesn't change the result. Now each Jimmy can support up to two `-`s close together. Count such pairs of `-`s and excess single `-`s.
[Answer]
# [///](https://esolangs.org/wiki////), 31 bytes
```
/---/--//- -/--//--/1//-/1// //
```
Input should be appended to the program, as permitted [here](https://codegolf.meta.stackexchange.com/a/10553/104752). Output is in unary.
[Try it online!](https://tio.run/##K85JLM5ILf7/X19XVxeI9fV1FaC0rr4hkAQRCiCeAhgCaTClAKbBCAj@/wcA "/// – Try It Online")
This uses the same idea as one of my other answers – reduce all long platforms to length 2, which doesn't change the result, and then each Jimmy can support up to two `-`s close together – but does it in a somewhat more complicated way.
```
                                Example string: "- --- -  ---- -"
/---/--/    Reduce long platforms to length 2   "- -- -  -- -"
/- -/--/    Close short gaps                    "----  ---"
/--/1/      Count pairs of -s                   "11  1-"
/-/1/       Count leftover single -s            "11  11"
/ //        Remove spaces                       "1111"
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), ~~21~~ 19 bytes
```
ＩΣＥ⪪Ｓ  ⌈⊘ΣＥ⪪ι ⌊⟦²Ｌλ
```
[Try it online!](https://tio.run/##S85ILErOT8z5/z@gKDOvRMM5sbhEI7g0V8M3sUAjuCAns0TDM6@gtCS4BCidrqGpo6CkoKAEpJxTM3NAIh6JOWWpKWhaMkHKQKp8M/Myc4FS0UY6Cj6peeklGRo5mrGaMGD9/7@ugoKCLlagAIZc/3XLcgA "Charcoal – Try It Online") Link is to verbose version of code. Explanation: Now a port of @Yousername's answer.
```
    Ｓ               Input string
   ⪪                Split on pairs of spaces
  Ｅ                 Map over runs
           ⪪ι       Split run on spaces
          Ｅ         Map over each platform
                 Ｌλ Length of platform
              ⌊⟦²   Minimum of that and 2
         Σ          Take the sum
        ⊘           Halved
       ⌈            Ceiling
 Σ                  Take the sum
Ｉ                   Cast to string
                    Implicitly print
```
]