You are viewing a single comment's thread. Return to all comments →
Kotlin Solution
fun caesarCipher(s: String, k: Int): String { return buildString{ s.map{ letter -> when { letter in 'a'..'z' -> append('a' + (letter - 'a' + k) % 26) letter in 'A'..'Z' -> append('A' + (letter - 'A' + k) % 26) else -> append(letter) } } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Caesar Cipher
You are viewing a single comment's thread. Return to all comments →
Kotlin Solution