Skip to content

Commit

Permalink
feat: Reto mouredev#1 - Swift
Browse files Browse the repository at this point in the history
  • Loading branch information
iRetr0o authored Aug 7, 2024
1 parent f1a2849 commit f66de32
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Retos/Reto #1 - EL LENGUAJE HACKER [Fácil]/swift/iRetr0o.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Foundation

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

var leetWord = ""
for letter in word {
leetWord += leetDictionary[letter.description.uppercased()] ?? letter.description
}
return leetWord
}

print(leetCode(word: "1337"))
print(leetCode(word: "Texto de prueba para comprobar que funciona"))

0 comments on commit f66de32

Please sign in to comment.