code: def string_to_int(string, alphabet):
      
      number = 0
      alpha_len = len(alphabet)
      for char in string:
          number = number * alpha_len + alphabet.index(char)
      return number
docs: Convert a string to a number, using the given alphabet.
      The input is assumed to have the most significant digit first.