def CodeFightly(alphabet, code)
  alphas = alphabet.each_char.to_a
  codes = code.each_char.to_a.map { |c| alphas.index(c) }

  index = -1
  carry = false
  begin
    codes[index] += 1
    carry = codes[index] == alphas.length
    if carry
      codes[index] = 0
      index -= 1
    end
    if -index > codes.length
      codes.unshift 1
      break
    end
  end while carry
  codes.map { |c| alphas[c] }.join
end
