Skip to content

Commit

Permalink
Merge pull request mouredev#6473 from allbertoMD/Reto-#01
Browse files Browse the repository at this point in the history
  • Loading branch information
Roswell468 authored Apr 28, 2024
2 parents ea0bc73 + 0359d60 commit a10df07
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions Retos/Reto #1 - EL LENGUAJE HACKER [Fácil]/swift/allbertoMD.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import Foundation


let hackerDictionary: [Character : String] = [
"a" : "4", "b" : "I3", "c" : "[", "d" : ")", "e" : "3", "f" : "|=", "g" : "&", "h" : "#",
"i" : "1", "j" : ",_|", "k" : ">|", "l" : "|_", "m" : "/\\/\\", "n" : "^/", "o" : "0",
"p" : "|*", "q" : "(_,)", "r" : "I2", "s" : "5", "t" : "7", "u" : "(_)", "v" : "\\/", "w" : "\\/\\/",
"x" : "><", "y" : "`/", "z" : "-/_", " " : " ", "A" : "4", "B" : "I3", "C" : "[", "D" : ")",
"E" : "3", "F" : "|=", "G" : "&", "H" : "#", "I" : "1", "J" : ",_|", "K" : ">|", "L" : "|_",
"M" : "/\\/\\", "N" : "^/", "O" : "0","P" : "|*", "Q" : "(_,)", "R" : "I2", "S" : "5",
"T" : "7", "U" : "(_)", "V" : "\\/", "W" : "\\/\\/", "X" : "><", "Y" : "`/", "Z" : "-/_"
]

func printHackerLenguage(_ str: String) -> String {
var hackerWord = ""

for s in str {
if let value = hackerDictionary[s] {
hackerWord.append(value)
}
}
return hackerWord
}

print("Ingresa el texto:")
if let input = readLine() {
let hackerWord = printHackerLenguage(input)
print(hackerWord)
}

0 comments on commit a10df07

Please sign in to comment.