Skip to content

Instantly share code, notes, and snippets.

@cslowik
Created January 28, 2016 18:44
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 cslowik/9569979d2bffa8b03416 to your computer and use it in GitHub Desktop.
Save cslowik/9569979d2bffa8b03416 to your computer and use it in GitHub Desktop.
Bloc Weekly Code Puzzle - Dubstep
import Foundation
func songDecoder(remix: String) -> String {
return remix.stringByReplacingOccurrencesOfString("WUB", withString: " ").componentsSeparatedByCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()).filter({!$0.isEmpty}).joinWithSeparator(" ")
}
print(songDecoder("WUBWEWUBAREWUBWUBTHEWUBCHAMPIONSWUBMYWUBFRIENDWUB"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment