Skip to content

Instantly share code, notes, and snippets.

@brunkb
Created February 1, 2016 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brunkb/1419124337e83f6569cd to your computer and use it in GitHub Desktop.
Save brunkb/1419124337e83f6569cd to your computer and use it in GitHub Desktop.
Scans a particular input string and counts differences from "SOS"
"SOSSOSSDSSKS"
.toList()
.withIndex()
.collect { val, index ->(val != "SOS"[index % 3] ? 1 : 0) }
.sum()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment