Created
January 7, 2020 13:52
-
-
Save AppleCEO/587bf781832447beab8407308543f75e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func solution(_ s:String) -> String { | |
var uppercaseToggle = true | |
return String(s.map { (character) -> Character in | |
if uppercaseToggle && character != " " { | |
uppercaseToggle = false | |
return Character(character.uppercased()) | |
} | |
uppercaseToggle = true | |
return Character(character.lowercased()) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment