All your bijective base are belong to us Background

A bijective base b numeration, where b is a positive integer, is a bijective positional notation that makes use of b symbols with associated values of 1 to b.

Unlike its non-bijective counterpart, no symbol has a value of 0. This way, each non-negative integer n has a unique representation in bijective base b.

Popular bijective numerations include unary, bijective base 2 (used in bzip2's run-length encoding) and bijective base 26 (used to number columns in spreadsheets).

Definition

In this challenge, we define the set M of symbols as

123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&lt;=&gt;


and a function i from M to the natural number such that i('1') = 1, &hellip;, i('>') = 64.

Given a base b between 1 and 64 (both inclusive), we define that each non-negative integer n corresponds to the string ak&hellip;a0, consisting  of symbols of M, such that n = bki(ak)+&hellip;+b0i(a0).

This correspondence is well-defined and bijective. Since an empty sum is defined as 0, the integer 0 can be encoded as an empty string.

Task

Accept three strings as input:


An input base b between 1 and 64, encoded as a bijective base 64 string.
A non-negative integer n, encoded as a bijective base b string.
An output base B between 1 and 64, encoded as a bijective base 64 string.


Given these three inputs, encode n as a bijective base B string.

Test cases

All test cases specify the input in the order b, n, B.

Input:  "4" "" "8"
Output: ""

Input:  "A" "16" "2"
Output: "1112"

Input:  "2" "122" "A"
Output: "A"

Input:  "3" "31" "1"
Output: "1111111111"

Input:  "&gt;" "Fe" "a"
Output: "RS"


Rules


You may read the three strings in any convenient order, as such, an array of strings, a string representation thereof, concatenated or separated by single-character delimiters of your choice.
If you choose to print the output to STDOUT, you may only print the symbols and (optionally) a trailing newline.
Base conversion built-ins of all kinds are allowed.
Standard code-golf rules apply.
CJam, 43

qA,s"?[a{A&lt;":,:^+:Mf#):B;(bLa{(Bmd)M=\j\+}j


3 bytes eradicated with help from Dennis :) Try it online

Explanation:

The input is taken as bnB, concatenated into a single string.

q           read the input
A,s         make an array of numbers from 0 to 9 and convert to string
"?[a{A&lt;"    push this string, which contains the ends of 3 character ranges:
             uppercase letters: ['A'…'[')
             lowercase letters: ['a'…'{')
             "&lt;=&gt;": ['&lt;'…'?')
             they're in a special order for the symmetric difference below
:,          for each character, make a range of all characters smaller than it
:^          fold/reduce these 6 ranges using symmetric difference
+           concatenate with the digits before
:M          save in M; this is like the M from the statement,
             except it starts with a zero (for matching indexes)
f#          find the indexes in M of all characters from the input string
)           take out the last value from the array
:B;         save it in B and pop it
(           take out the first value
b           use it as a base and convert the remaining array to a number
             this works even if some of the digits are not in the "normal" range
La{…}j      calculate with memoized recursion, using an empty string for value 0
  (         decrement the number
  Bmd       divide by B and get the quotient and remainder
  )         increment the remainder (this is the last digit in bijective base B)
  M=        get the corresponding character from M
  \j        swap with the quotient, and convert the quotient recursively
  \+        swap again and concatenate