Let's work backwards for this one. We first turn the digits into their binary representations. We go from VW626206555675126212043640270477001760465526277571600601
to VW++__+_++__+____++_+_++_++_+++_++++_+__+_+_++__+___+_+____+___++++_+______+_+++___+__++++++________++++++____+__++_+_++_+_+_++__+_+++++++_++++__+++_______++______+
. Next, we keep applying the inverse of DCW:W+
and DW:W_
until we clear all symbols. Our result is now VDCDCDDDCDDCDCDDDCDDDDDCDCDDCDDCDCDDCDCDDCDCDCDDCDCDCDCDDCDDDCDDCDDCDCDDDCDDDDCDDCDDDDDCDDDDCDCDCDCDDCDDDDDDDCDDCDCDCDDDDCDDDCDCDCDCDCDCDDDDDDDDDCDCDCDCDCDCDDDDDCDDDCDCDDCDDCDCDDCDDCDDCDCDDDCDDCDCDCDCDCDCDCDDCDCDCDCDDDCDCDCDDDDDDDDCDCDDDDDDDCW
. We now want to make this string match VD+C+W
; that is, we want to move all of the D
s to the left of all of the C
s. This can be done by reversing DCC:CD
. We do this by repeating the following algorithm:
- Find the first
D
that is to the right of a block of C
s.
- Move the
D
to the left of that block.
- Double the number of
C
s.
Through some math, we can determine that we will end up with 123 D
s and 4638704741628490670592103344196019722536654143873 C
s (you were right about this not fitting in an SE answer... I doubt this would fit if stored as states of all of the atoms in the Earth combined :P).
If we keep applying the reverse of V:VD
, we can get rid of all of the D
s now, so we get VCCC.......CCCW
. We convert the V
back into YZ
. Now we have YZCCC.......CCCW
.
We want to be able to get rid of all of the C
s and have it in the form YAAA...AAABBB...BBBZW
. Fortunately, this can be done by the following method. Firstly, we inverse-apply YB:Y
587912508217580921743211 times to get YBBB.......BBBZCCC.......CCCW
. Then, we repeat the following sequence of steps (where [?*]
means any number of ?
, not necessarily greater than zero):
- Inverse-apply
CZ:ZC
587912508217580921743211 times to get Y[A*]BBB.......BBBCCC.......CCCZCCC.......CCCW
- Inverse-apply
CB:BC
many times to get Y[A*]BCBCBC.......BCBCBCZCCC.......CCCW
- Inverse-apply
AZ:Z
and AB:BCA
many times to get Y[A*]ABBB.......BBBZCCC.......CCCW
Through induction, we see that we can move the BZ
combination all the way to the end (except before the W
) and then the number of A
s is 1/587912508217580921743211 of the number of C
s, leaving us with 7890127658096618386747843 A
s. We now have YAAA.......AAABBB.......BBBZW
. Convert the ZW
back to a U
, then inverse-apply U:BU
many times to keep only 2 B
s and then convert the BBU
to a T
, and you now have YAAA.......AAAT
. Then, you can inverse-apply T:AAAAAT
many times to get YAAAT
because the number of A
s was 3 larger than a multiple of 5.
Thanks for the challenge!