Fridge magnet substitution When writing a message with fridge magnets, you'll often find yourself substituting a 1 for an I. In this challenge, your goal is to find out if a message can be written using the letters of another message. The allowed substitutions are:

A = 4
B = 8
C = U
E = M = W = 3
G = 6 = 9
I = 1
L = 7
N = Z
O = 0
R = 2
S = 5


For example, the message CIRCA 333 can be rearranged to spell ICE CREAM, where the first two 3s are rotated 180 degrees to make two Es, and the last 3 is rotated 90 degrees counterclockwise to make an M. Whitespaces can be included in the messages, but they should not be accounted for in your solution, as they're made by placing the magnets on the fridge. 

Input

Two strings (or character arrays). All messages will match ^[A-Z0-9 ]+$

Output

Truthy if the two input strings are valid rearrangements of each other, falsey otherwise.

Examples

["CIRCA 333", "ICE CREAM"] =&gt; true
["DCLV 00133", "I LOVE CODE"] =&gt; true
["WE ARE EMISSARIES", "33   423    3315542135"] =&gt; true
["WE WANT ICE CREAM", "MET CIRCA 334 MEN"] =&gt; true
["I HAVE ICE CREAM", "HAVE 2 ICE CREAMS"] =&gt; false


More thruthy examples

These are all the 15+ letter words that map to another word. Some are trivial substitutions, but I included all that I found.

["ANTHROPOMORPHISE","ANTHROPOMORPHISM"]
["ANTIPHILOSOPHIES","ANTIPHILOSOPHISM"]
["CIRCUMSTANTIALLY","ULTRAMASCULINITY"]
["DECENTRALIZATION","DENEUTRALIZATION"]
["DIMETHYLNITROSAMINE","THREEDIMENSIONALITY"]
["INSTITUTIONALISE","INSTITUTIONALISM"]
["INTERCRYSTALLINE","INTERCRYSTALLIZE"]
["INTERNATIONALISE","INTERNATIONALISM"]
["OVERCENTRALIZATION","OVERNEUTRALIZATION"]
["OVERCENTRALIZING","OVERNEUTRALIZING"]
["PREMILLENNIALISE","PREMILLENNIALISM"]
["TRANSCENDENTALIZE","TRANSCENDENTALIZM"]


As this is a code golf challenge, the shortest solution wins! I will accept the shortest solution in 7 days from posting. Happy golfing!

Sample solution, non-golfed

Related


My daughter's alphabet
Foam bath letters


EDIT: Made an error in the substitutions, had G = 6 and 6 = 9 as separate substitutions, merged them into one.
Python 2, 145 131 130 129 125 bytes



lambda*a:all(len({sum(map(w.count,x))for w in a})&lt;2for x in'A4 B8 CU EMW3 G69 I1 L7 NZ O0 R2 S5'.split()+list('DFHJKPQTVXY'))


Try it online!

Alt:

Python 2, 125 bytes



lambda*a:len({(x,sum(map(w.count,x)))for x in'A4 B8 CU EMW3 G69 I1 L7 NZ O0 R2 S5'.split()+list('DFHJKPQTVXY')for w in a})&lt;23


Try it online!