Skip to main content
added 326 characters in body
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 294

Jelly, 11 bytes

e€ØẠŒg§ḟ0Æṃ

A monadic Link accepting a list of characters which yields an integer.

Try it online! Or see the test-suite.

How?

e€ØẠŒg§ḟ0Æṃ - Link: S
  ØẠ        - alphabetic characters
 €          - for each (c in S)
e           -   (c) exists in (S)?
    Œg      - group runs of equal elements (1s or 0s)
      §     - sums
        0   - zero
       ḟ    - filter discard
         Æṃ - mode

Jelly, 11 bytes

e€ØẠŒg§ḟ0Æṃ

A monadic Link accepting a list of characters which yields an integer.

Try it online! Or see the test-suite.

Jelly, 11 bytes

e€ØẠŒg§ḟ0Æṃ

A monadic Link accepting a list of characters which yields an integer.

Try it online! Or see the test-suite.

How?

e€ØẠŒg§ḟ0Æṃ - Link: S
  ØẠ        - alphabetic characters
 €          - for each (c in S)
e           -   (c) exists in (S)?
    Œg      - group runs of equal elements (1s or 0s)
      §     - sums
        0   - zero
       ḟ    - filter discard
         Æṃ - mode
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 294

Jelly, 11 bytes

e€ØẠŒg§ḟ0Æṃ

A monadic Link accepting a list of characters which yields an integer.

Try it online! Or see the test-suite.