26
\$\begingroup\$

I want to be down with the kids of the 1990's and start speaking this L33T speak of their's.

For any given input I would like the resulting L33T speech as an output.

I don't want to go to far down the rabbit hole so let's start simple. Consider the following replacements:

B or b = 8

E or e = 3

I or i = 1

S or s = 5

Lets get down with the kids people.

\$\endgroup\$
7
  • 71
    \$\begingroup\$ Bruh, it's 1337 \$\endgroup\$
    – Poke
    Commented Nov 18, 2019 at 14:53
  • 10
    \$\begingroup\$ Not sure why this was VTC questions without an objective primary winning criterion are off-topic, since the challenge was tagged as code-golf from the beginning. \$\endgroup\$
    – Arnauld
    Commented Nov 18, 2019 at 16:07
  • 6
    \$\begingroup\$ We need an answer in l33t. \$\endgroup\$
    – Arnauld
    Commented Nov 18, 2019 at 23:55
  • 1
    \$\begingroup\$ @some_guy632 There is no 7 in L33T as OP mentions. But then again, OP thinks that "i" is substituted with 1. So yeah, this might be a whole different dialect! Not sure which 90s kids were using this, though ... \$\endgroup\$
    – Num Lock
    Commented Nov 19, 2019 at 6:41
  • \$\begingroup\$ 1 in Chinese sounds like an i. \$\endgroup\$
    – user85052
    Commented Nov 20, 2019 at 9:31

43 Answers 43

1
2
1
\$\begingroup\$

C (gcc), 152 143 140 128 bytes

a[256];c=256;main(){for(;a[c]=--c;)a[66]=a[98]=56;for(a[69]=a[101]=51;c=~getchar(a[73]=a[105]=49);printf(a+~c))a[83]=a[115]=53;}

Requires ASCII. Try it online!

  • -8 bytes using this to transform ASCII characters to their codes and using c+1 rather than c>-1 to check if EOF is reached
  • -3 bytes using toupper rather than tolower and changing all characters to their ASCII codes
  • -3 bytes abandoning that whole track together and using a character dictionary instead
  • -12 bytes thanks to @ceilingcat
\$\endgroup\$
2
  • \$\begingroup\$ 96 bytes \$\endgroup\$
    – ceilingcat
    Commented Nov 21, 2019 at 19:46
  • \$\begingroup\$ @ceilingcat That seems to be borrowing a lot of ideas from my answer... \$\endgroup\$
    – S.S. Anne
    Commented Nov 21, 2019 at 21:18
1
\$\begingroup\$

Icon, 52 bytes

I was looking for a way to represent the 8-digit number as a shorter expression, but only got the same length:

procedure f(s)
return map(s,"ESIseiBb",77^4+147)
end

Try it online!

Icon, 52 bytes

procedure f(s)
return map(s,"BEISbeis",83158315)
end

Try it online!

Test case taken from @Arnauld

\$\endgroup\$
1
\$\begingroup\$

Clojure, 101 bytes

(defn l[s](clojure.string/replace s #"[BEISbeis]"{"B""8""b""8""E""3""e""3""I""1""i""1""S""5""s""5"}))

Try it online!

\$\endgroup\$
1
\$\begingroup\$

Perl 6, 19 bytes

{TR/beisBEIS/8315/}

Try it online!

Kinda annoying that the case-insensitive adverb doesn't work with transliteration. That's made up a little by the second half cycling for both cases.

\$\endgroup\$
1
\$\begingroup\$

C# .NET, 145 bytes

class P{static void Main(string[]a){foreach(var c in a[0]){var d=c%32;System.Console.Write((char)(c>64?d==5?51:d==2?65:d==9?49:d==19?53:c:c));}}}

Try Online

\$\endgroup\$
2
1
\$\begingroup\$

///, 40 bytes

/B/b//b/8//E/e//e/3//I/i//i/1//S/s//s/5/

Input should be appended to the program.

Try it online!

\$\endgroup\$
1
\$\begingroup\$

K (oK), 29 bytes

Solution:

{x[&y=_x]:z}/[;"ebis";"3815"]

Try it online!

Explanation:

There is no ssr in oK, this is good enough for single character replacement.

Explanation:

{x[&y=_x]:z}/[;"ebis";"3815"] / the solution
{          }/[;      ;      ] / lambda that iterates over implicit x, y and z
                      "3815"  / our z, leet characters
               "ebis"         / our y, non-leet characters
 x[     ]:z                   / assign z to x at indices given inside []
      _x                      / lowercase x
    y=                        / equal to y?
   &                          / indices where true
\$\endgroup\$
1
\$\begingroup\$

GolfScript, 28 bytes

Translation stolen from Peter Taylor.

{.'beisBEIS'?'8315'2*@),+=}%

Try it online!

\$\endgroup\$
1
\$\begingroup\$

Python, 88 bytes

lambda s:''.join([('8315'*2)['beisBEIS'.find(c)] if c in 'beisBEIS' else c for c in s])
\$\endgroup\$
3
  • \$\begingroup\$ Welcome to the site! \$\endgroup\$
    – MD XF
    Commented Nov 18, 2019 at 23:40
  • 2
    \$\begingroup\$ 60 bytes \$\endgroup\$
    – Jo King
    Commented Nov 19, 2019 at 7:28
  • \$\begingroup\$ The size wasn't wrong. Jo King linked to a better solution which is 60 bytes long. \$\endgroup\$
    – S.S. Anne
    Commented Nov 22, 2019 at 17:27
0
\$\begingroup\$

Q/kdb+, 26 bytes

Solution:

ssr/[;"ebisEBIS";8#"3815"]

Examples:

q)ssr/[;"ebisEBIS";8#"3815"]"Elite!"
"3l1t3!"
q)ssr/[;"ebisEBIS";8#"3815"]"The quick brown fox..."
"Th3 qu1ck 8rown fox..."

Explanation:

Perform search and replace over the input

ssr/[;"ebisEBIS";8#"3815"] / the solution
ssr/[;          ;        ] / iterate (/) ssr[input;find;replace]
                 8#"3815"  / 8 take "3815" => "38153815"
      "ebisEBIS"           / the string "ebisEBIS"
\$\endgroup\$
0
\$\begingroup\$

Mumps (M), 32 bytes

R I W $TR(I,"BbEeIiSs",88331155)

Although... it might look a tad 'weird.' Mumps doesn't output a carriage return even if typed on input, so the input & output will be all in a single line. To aid readability, add 2 characters:

R I W !,$TR(I,"BbEeIiSs",88331155)
\$\endgroup\$
0
\$\begingroup\$

C (gcc), 84 83 bytes

-1 byte thanks to ceilingcat!

n[]={[83]=5,[73]=1,[69]=3,[66]=8},c;f(char*s){for(;*s;c?*s=c+48:c,s++)c=n[*s&~32];}

Ungolfed and commented:

int n[] = 
{ /* lookup table */
    ['S'] = 5,
    ['I'] = 1,
    ['E'] = 3,
    ['B'] = 8
};
int c;

void f(char *s)
{
    /* if lookup table entry is not empty,
         set *s to that entry + '0' for the ASCII representation
       else do nothing
       increment s and repeat */
    for( ; *s; c ? (*s = c + '0') : c, s++ )
        c = n[*s & ~32]; /* uppercase */
}

Try it online!

\$\endgroup\$
0
0
\$\begingroup\$

Thunno 2, 12 bytes

“ʋḶ“ḲR+« ɓṂṆ

Try it online!

Port of Kevin Cruijssen's 05AB1E answer.

Explanation

“ʋḶ“ḲR+« ɓṂṆ  # Implicit input
“ʋḶ“          # Compressed string "beis"
    ḲR+       # Append reversed uppercase version
       « ɓṂ   # Compressed number 83155138
           Ṇ  # Transliterate "beisSIEB" -> "83155138"
              # Implicit output
\$\endgroup\$
1
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.