// 7H15 M3554G3 is written in leet speak, where numbers resemble letters.
// place each leetspeak character with its matching letter
// (7 -> T, 1 -> I, 5 -> S, 3 -> E) and build a new string
// 7H15 -> THIS | M3554G3 -> MESSAGE
// Your brain can interpret distorted or number‑substituted letters
// surprisingly well because it recognizes the overall word
// shapes and patterns, not just individual characters.
program LeetDecoder;
{$mode objfpc}
uses
SysUtils;
// ------------------------------------------------------------
// Convert a single leet character into a normal alphabet letter
// ------------------------------------------------------------
function DecodeChar(c: Char): Char;
begin
case c of
'7': Result := 'T';
'1': Result := 'I';
'5': Result := 'S';
'3': Result := 'E';
'4': Result := 'A';
'0': Result := 'O';
else
Result := c; // keep letters like H, M, G, etc.
end;
end;
// ------------------------------------------------------------
// Convert an entire string from leet speak to normal text
// ------------------------------------------------------------
function DecodeLeet(const s: String): String;
var
i: Integer;
begin
SetLength(Result, Length(s));
for i := 1 to Length(s) do
Result[i] := DecodeChar(s[i]);
end;
var
lines: array[1..10] of String;
i: Integer;
begin
// Test lines provided by the user
lines[1] := '7H15 M3554G3';
lines[2] := '53RV35 7O PR0V3';
lines[3] := 'H0W 0UR M1ND5 C4N';
lines[4] := 'D0 4M4Z1NG 7H1NG5!';
lines[5] := '1MPR3551V3 7H1NG5!';
lines[6] := '1N 7H3 B3G1NN1NG';
lines[7] := '17 WA5 H4RD BU7';
lines[8] := 'N0W, Y0UR M1ND 1S';
lines[9] := 'R34D1NG 17';
lines[10] := '4U70M471C4LLY.';
// Decode and print each line
for i := 1 to 10 do
WriteLn(DecodeLeet(lines[i]));
end.
(*
run:
THIS MESSAGE
SERVES TO PROVE
HOW OUR MINDS CAN
DO AMAZING THINGS!
IMPRESSIVE THINGS!
IN THE BEGINNING
IT WAS HARD BUT
NOW, YOUR MIND IS
READING IT
AUTOMATICALLY.
*)