[Swift] 프로그래머스 12951 JadenCase 문자열 만들기
·
📝 코테/프로그래머스
func solution(_ s: String) -> String { var first = true var res = "" for c in s { if c == " "{ res += " " first = true continue } if first { if let test = Int(String(c)) { res += String(c) } else { res += String(c).uppercased() } first = false } else { res += String(c).lowercased() } } return res } 쉬울 줄 알았는데 생각보다 막혔다. 추가하면 좋은 테케 입력 : " for the last week " 출력: " For The Last Week " 공백을 고려해야해서 반복을..