If 44-33-555-555-666
is hello
and 9-666-777-555-3
is world
, what is:
9-33-0-2-777-33-0-3-33-888-33-555-666-7-33-777-7777
= ???
Can you do an encoder/decoder for this way of writing?
It is pretty obvious, that numbers between dashes encode letters, knowing the first two words, we can easily figure that the phrase is (? == unknown letter):
?-e-?-?-r-e-?-d-e-?-e-l-o-?-e-r-?
If we assume that 0 == space
, then the phrase looks like
we are developers
In that case we also know some other letters. Putting them all together we have:
A=2
B=
C=
D=3
E=33
F=
G=
H=44
I=
J=
K=
L=555
M=
N=
O=666
P=7
Q=
R=777
S=7777
T=
U=
V=888
W=9
X=
Y=
Z=
It looks like it is pretty obvious what is missing, so the full solution looks like:
<SPACE>=0
A=2
B=22
C=222
D=3
E=33
F=333
G=4
H=44
I=444
J=5
K=55
L=555
M=6
N=66
O=666
P=7
Q=77
R=777
S=7777
T=8
U=88
V=888
W=9
X=99
Y=999
Z=9999
key = {
" ": 0,
"A": 2,
"B": 22,
"C": 222,
"D": 3,
"E": 33,
"F": 333,
"G": 4,
"H": 44,
"I": 444,
"J": 5,
"K": 55,
"L": 555,
"M": 6,
"N": 66,
"O": 666,
"P": 7,
"Q": 77,
"R": 777,
"S": 7777,
"T": 8,
"U": 88,
"V": 888,
"W": 9,
"X": 99,
"Y": 999,
"Z": 9999,
}
string = input("Enter a string: ")
output = []
for l in string:
try:
code = key[l.upper()]
except KeyError:
code = "?"
output.append(code)
print("-".join(str(x) for x in output))
"W": 9, "X": 99, "Y": 999, "Z": 9999,
}
string = input("Enter a string: ")
output = []
for l in string:
try:
code = key[l.upper()]
except KeyError:
code = "?"
output.append(code)print("-".join(str(x) for x in output))
Love the lazy approach of not trying to detect the order in the string, but use a lookup table instead :)
it works 🤷♂️
Here is (verbose) programmatic version 😀 (no UI)
https://gist.github.com/gpetrioli/cfc05bb447f2706f2de833c9cea4e351
GPT-4 did the work for me after I uploaded a screenshot of the puzzle:
The image you've uploaded appears to be a puzzle that uses numbers to represent letters, most likely following the convention of T9 predictive text input, which was commonly used on phones to type out text messages using the numeric keypad.
In T9 text input, each number from 2 to 9 corresponds to a set of letters:
The number of times a number is repeated could indicate the position of the letter within that group. For example, the number "2" pressed once would be "A", pressed twice would be "B", and pressed three times would be "C".
Using this logic, let's decipher the given codes:
For "hello", the sequence is 44-33-555-555-666. Deciphered, this means:
For "world", the sequence is 9-666-777-555-3. Deciphered, this means:
Now, let's decipher the last sequence using the same logic:
I will now decrypt this sequence for you.
The decrypted message from the puzzle is "WE ARE DEVELOPERS". Each series of numbers corresponds to a letter, similar to how T9 predictive text input works on a numeric keypad.