From 28ffc6736c545a69642f2a598808bbdadf022556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oscar=20Guti=C3=A9rrez?= <98203302+iRetr0o@users.noreply.github.com> Date: Sat, 30 Nov 2024 18:41:22 -0600 Subject: [PATCH] feat: Reto #1 - Kotlin --- .../kotlin/iRetr0o.kt" | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 "Retos/Reto #1 - EL LENGUAJE HACKER [F\303\241cil]/kotlin/iRetr0o.kt" diff --git "a/Retos/Reto #1 - EL LENGUAJE HACKER [F\303\241cil]/kotlin/iRetr0o.kt" "b/Retos/Reto #1 - EL LENGUAJE HACKER [F\303\241cil]/kotlin/iRetr0o.kt" new file mode 100644 index 0000000000..16c0db55f7 --- /dev/null +++ "b/Retos/Reto #1 - EL LENGUAJE HACKER [F\303\241cil]/kotlin/iRetr0o.kt" @@ -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 +} \ No newline at end of file