Skip to content

Commit

Permalink
Merge pull request #6698 from iRetr0o/main
Browse files Browse the repository at this point in the history
Reto #1 - Kotlin
  • Loading branch information
kontroldev authored Dec 1, 2024
2 parents a66d9ee + 28ffc67 commit 19d4feb
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Retos/Reto #1 - EL LENGUAJE HACKER [Fácil]/kotlin/iRetr0o.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
fun main() {
println(leetCode(word = "1337"))
println(leetCode(word = "Texto de prueba para comprobar que funciona"))
}

fun leetCode(word: String): String {
val leetDictionary = mapOf("A" to "4", "B" to "I3", "C" to "[", "D" to ")", "E" to "3", "F" to "|=", "G" to "&", "H" to "#", "I" to "1", "J" to ",_|", "K" to ">|", "L" to "1", "M" to "/\\/\\", "N" to "^/", "O" to "0", "P" to "|*", "Q" to "(_,)", "R" to "I2", "S" to "5", "T" to "7", "U" to "(_)", "V" to "\\/", "W" to "\\/\\/", "X" to "><", "Y" to "j", "Z" to "2", "1" to "L", "2" to "R", "3" to "E", "4" to "A", "5" to "S", "6" to "b", "7" to "T", "8" to "B", "9" to "g", "0" to "o")

var leetWord = ""
for (letter in word) {
leetWord += leetDictionary[letter.uppercase()] ?: letter
}

return leetWord
}

0 comments on commit 19d4feb

Please sign in to comment.