Convert number bases What your function must do:
be as short (in bytes) as possible
take 3 inputs that are strings: number , fromdigits, todigits
assume no digit is repeated in fromdigits or todigits
assume fromdigit and todigit contain only alphanumeric characters
assume number is a natural number
output (a string): number converted to frombase
examples:
convert("ff","0123456789abcdef","0123456789")="255"
convert("ee","fecdba9876543210","9876543210")="82"
example code (283 bytes, in python 3.4.1):  

def convert(number,fromdigits,todigits):
    x=0
    for digit in str(number): 
        x = x*len(fromdigits)+fromdigits.index(digit)
    res=""
    while x&gt;0:
        digit = x % len(todigits)
        res = todigits[digit] + res
        x //= len(todigits)
    return res
Python - 101

To get started I basically golfed your example code...

def c(n,f,t,x=0,r=""):
 for d in n:x=x*len(f)+f.index(d)
 while x:l=len(t);r=t[x%l]+r;x//=l
 return r