Introduction
I have used Swift for windows 1.9 for debugging purpose. But you can use any Swift programming language compiler as per your availability.
func casestr(_ input: String) -> String { if input.characters.count < 3 { return input.lowercased() } else { var newInput = input.characters var str1: String = "" let lastThree = newInput.suffix(3) newInput.removeLast(3) let lastThreeUpper = String(lastThree).uppercased() str1.append(contentsOf: newInput) str1.append(String(lastThree).uppercased()) return str1 } } print(casestr("TechStudy.org")) print(casestr("Swift"))