Read color in my way Different systems have different ways to describe colors, even if all of them are speaking in R-G-B-A space. A front-end developer who is familiar with CSS may prefer #RRGGBBAA. But Android developers may prefer #AARRGGBB. When handling AAS file format, #AABBGGRR is needed. That's too confusing. Maybe we need a program which can convert between different color formats.

Input:

The input contains 3 parts:


The color to be transformed (e.g. #1459AC0F), a string starting with sharp sign # followed by 8 hex digits.
The format of the given color (e.g. #RRGGBBAA), a string starting with # followed by 8 letters which fall into 4 different groups and each group is one of RR/GG/BB/AA.
The format to convert to.


Output:


Output the color in converted format


Test Cases:

Color, OriginalFormat, TargetFormat -&gt; Result
#12345678, #RRGGBBAA, #AARRGGBB -&gt; #78123456
#1A2B3C4D, #RRGGBBAA, #AABBGGRR -&gt; #4D3C2B1A
#DEADBEEF, #AARRGGBB, #GGBBAARR -&gt; #BEEFDEAD


Input / output are case insensitive. You may input / output in any acceptable way.

Rules:

This is code golf, shortest (in byte) codes of each language win
APL (Dyalog Unicode), 6 bytesSBCS



Full program. Prompts on STDIN for Original, then Target, then Color. Prints Result to STDOUT.

⍞[⍞⍋⍞]


Try it online!

  ⍞ prompt for Original

 ⍞⍋ prompt for Target and find the indices into Original that would make Original into Target

⍞[…] prompt for Color and use the above obtained indices to reorder Color