# Task
 You are given a car odometer which displays the miles traveled as an integer. 
 
 The odometer has a defect, however: it proceeds from digit `3` to digit `5` always skipping the digit `4`. This defect shows up in all positions (ones, tens, hundreds, etc). 
 
 For example, if the odometer displays `15339` and the car travels another mile, the odometer changes to `15350` (instead of `15340`).

 Your task is to calculate the real distance, according The number the odometer shows.

# Example

 For `n = 13` the output should be `12`(4 skiped).
 
 For `n = 15` the output should be `13`(4 and 14 skiped).
 
 For `n = 2003` the output should be `1461`.

# Input/Output


 - `[input]` integer `n`

  The number the odometer shows.
  
  `1 <= n <= 999999999`


 - `[output]` an integer

  The real distance.

Difficulty: EASY
Starter code: def faulty_odometer(n):
	

Solutions:
tr = str.maketrans('56789', '45678')

def faulty_odometer(n):
	return int(str(n).translate(tr), 9)


def faulty_odometer(n):
	result = 0
	digits = len(str(n))
	nonaryTranslation = ''.join([str(int(x) - 1) if int(x) >= 5 else x for x in list(str(n))])
	for i in nonaryTranslation:
		digits -= 1
		result += int(i) * 9 ** digits
	return result


def faulty_odometer(n, acc=0):
	rang = len(str(n)) - 1
	amt = int('1' + '0' * rang)
	q = n // amt
	if q >= 4:
		n -= amt
		q -= 1
	res = n - (amt - 9 ** rang) * q
	left = n - amt * q
	acc += res - left
	return faulty_odometer(left, acc) if left >= 4 else acc + left


faulty_odometer = lambda n: int(str(n).translate(''.maketrans('56789', '45678')), 9)


def faulty_odometer(n):
	return sum(('012356789'.index(c) * 9 ** i for (i, c) in enumerate(str(n)[::-1])))


def faulty_odometer(n):
	digits = []
	while n > 0:
		digits.append(n % 10)
		n //= 10
	result = 0
	count = len(digits)
	for i in range(len(digits) - 1, -1, -1):
		if digits[i] >= 5:
			digits[i] -= 1
		result += digits[i] * 9 ** (count - 1)
		count -= 1
	return result