loading...

re: Daily Challenge #272 - Printer Errors VIEW POST

FULL DISCUSSION
 

Kotlin

fun printer_error(input: String): String
    = "${input.filter { it !in 'a'..'m'}.length}/${input.length}"

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
Code of Conduct Report abuse