Given an integer `n`, find two integers `a` and `b` such that:
```Pearl
A) a >= 0 and b >= 0
B) a + b = n
C) DigitSum(a) + Digitsum(b) is maximum of all possibilities.  
```
You will return the digitSum(a) + digitsum(b). 

```
For example:
solve(29) = 11. If we take 15 + 14 = 29 and digitSum = 1 + 5 + 1 + 4 = 11. There is no larger outcome.
```
`n` will not exceed `10e10`.

More examples in test cases. 

Good luck!

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def solve(n):
	

Solutions:
def solve(n):
	if n < 10:
		return n
	a = int((len(str(n)) - 1) * '9')
	b = n - a
	return sum([int(i) for i in list(str(a)) + list(str(b))])


def solve(n):
	a = (len(str(n)) - 1) * '9' or '0'
	return sum(map(int, a + str(n - int(a))))


def solve(n):
	a = 0
	while a * 10 + 9 <= n:
		a = a * 10 + 9
	return sum(map(int, str(a) + str(n - a)))


def solve(n):
	l = len(str(n)) - 1
	return sum(map(int, str(n - 10 ** l + 1))) + 9 * l


def solve(param):
	a = int('0' + '9' * (len(str(param)) - 1))
	return sum((int(d) for d in str(a) + str(param - a)))


def solve(n):
	a = 10 ** (len(str(n)) - 1) - 1
	return sum(map(int, str(a) + str(n - a)))


solve = lambda n: sum(map(int, str(n - int('0' + '9' * (len(str(n)) - 1))))) + 9 * (len(str(n)) - 1)


def solve(n):
	return n if n < 10 else 9 + solve(n // 10) if n % 10 == 9 else 10 + n % 10 + solve(n // 10 - 1)


def solve(x):
	if not x:
		return x
	b = int(str(int(str(x)[0]) - 1) + ''.join(('9' for i in range(len(str(x)) - 1))))
	a = x - b
	return sum([int(i) for i in str(a)]) + sum([int(i) for i in str(b)])


def solve(n):
	n = str(n)
	a = str(int(n[0]) - 1) + '9' * (len(n) - 1)
	b = str(int(n) - int(a))
	return sum((int(i) for i in a + b)) if int(n) else 0