-
-
Save cnovoab/07c5870295b95241e4fa to your computer and use it in GitHub Desktop.
String name = new String("silas"); | |
Integer suffix = new Integer(10); | |
name.reverse().append(suffix.toString()); |
PHP version:
$name = "silas";
$laz_assoc_array = array( "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten");
echo strrev($name) . $laz_assoc_array[10];
JS:
var name = "silas";
var laz_array = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"];
alert(name.split("").reverse().join("") + laz_array[10]);
Bash port:
#!/bin/bash
name="silas"
laz_array=("zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten")
reversed_name=$(echo $name | rev)
echo "$reversed_name${laz_array[10]}"
Other approach can be using random chars until we get the "SALISTEN" word
i = 0
salisten_word = "SALISTEN"
word = ""
while salisten_word != word
random_char = 65.+(rand(25)).chr
puts word + random_char
if random_char == salisten_word[i]
word = word + random_char
i = i + 1
next
end
end
The results you can get are:
E
A
Q
C
S
SD
SW
ST
SH
SM
SE
SW
SP
SI
SN
SW
SI
SM
SA
SAA
SAH
SAN
SAY
SAG
SAJ
SAK
SAV
SAA
SAG
SAP
SAL
SALY
SALV
SALG
SALF
SALU
SALP
SALH
SALE
SALI
SALIK
SALIX
SALIB
SALIE
SALIO
SALIX
SALIY
SALIU
SALIR
SALIK
SALIN
SALIF
SALIQ
SALIH
SALIT
SALIY
SALIE
SALIY
SALIT
SALIV
SALIN
SALIL
SALIO
SALIS
SALISY
SALISO
SALISQ
SALISP
SALISH
SALISE
SALISO
SALISL
SALISL
SALISX
SALISP
SALISF
SALISQ
SALISX
SALISO
SALISS
SALISE
SALISG
SALISD
SALISD
SALISF
SALISA
SALISB
SALISX
SALISP
SALISV
SALISV
SALISG
SALISC
SALISW
SALISL
SALISX
SALISB
SALISL
SALISO
SALISE
SALISG
SALISB
SALISP
SALISD
SALISG
SALISM
SALISG
SALISL
SALISH
SALISI
SALISJ
SALISS
SALISG
SALISQ
SALISL
SALISI
SALISF
SALISF
SALISJ
SALIST
SALISTK
SALISTG
SALISTA
SALISTS
SALISTE
SALISTEW
SALISTER
SALISTEP
SALISTEQ
SALISTEN
I've ported this code to Objective-C