In a factory, a printer prints labels for boxes. For one kind of box, the printer has to use colors which, for the sake of simplicity, are named wi...
For further actions, you may consider blocking this person and/or reporting abuse
JS
JS - Functional, no regex.
Python solution 🐍
Haskell
Test
Kotlin
Output
printer_error("aaabbbbhaijjjm")
->0/14
printer_error("aaaxbbbbyyhwawiwjjjwwm")
->8/22
printer_error("aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbmmmmmmmmmmmmmmmmmmmxyz")
->3/56
printer_error("aaabbbbbbccccccddddddeee")
->0/24
printer_error("verylargepiggoesoink")
->9/20
Python
Here is the simple solution with PHP and
ASCII
code function:JS w/ regexp
Python w/o regexp
nodejs
And a silly one:
JavaScript
how to count with javascript regex
Ruby
Javascript
Javascript