The written representation of a number (with 4 or more digits) can be split into three parts in various different ways. For example, the written number 1234 can be split as [1 | 2 | 34] or [1 | 23 | 4] or [12 | 3 | 4].

Given a written number, find the highest possible product from splitting it into three parts and multiplying those parts together. For example:

- product of [1 | 2 | 34] = 1 \* 2 \* 34 = 68
- product of [1 | 23 | 4] = 1 \* 23 \* 4 = 92
- product of [12 | 3 | 4] = 12 \* 3 \* 4 = 144

So maximumProductOfParts(1234) = 144

For a longer string there will be many possible different ways to split it into parts. For example, 8675309 could be split as: 

- [8 | 6 | 75309] 
- [867 | 530 | 9] 
- [8 | 67 | 5309]
- [86 | 75 | 309]

or any other option that splits the string into three parts each containing at least one digit.

Source: codewars | Difficulty: EASY

Starter code: def maximum_product_of_parts(n):
	

Solutions:
from functools import reduce
from operator import mul

def maximum_product_of_parts(n):
	s = str(n)
	return max((reduce(mul, map(int, (s[:i], s[i:j], s[j:]))) for i in range(1, len(s) - 1) for j in range(i + 1, len(s))))


def maximum_product_of_parts(number):
	(s, n, result) = (str(number), len(str(number)), 0)
	for i in range(1, n - 1):
		for j in range(i + 1, n):
			(start, middle, end) = (s[0:i], s[i:j], s[j:])
			result = max(result, int(start) * int(middle) * int(end))
	return result


def maximum_product_of_parts(n: int) -> int:
	n = str(n)
	return max([int(n[:i]) * int(n[i:j]) * int(n[j:]) for i in range(1, len(n) + 1) for j in range(i + 1, len(n))])


import itertools

def maximum_product_of_parts(n):
	s = str(n)
	return max((int(s[:i]) * int(s[i:j]) * int(s[j:]) for (i, j) in itertools.combinations(range(1, len(s)), 2)))


def maximum_product_of_parts(n):
	n = str(n)
	s = []
	for i in range(1, len(n) - 1):
		for h in range(i + 1, len(n)):
			(f, m, l) = (int(n[0:i]), int(n[i:h]), int(n[h:]))
			s.append(f * m * l)
	return max(s)


def maximum_product_of_parts(n):
	products = []
	n = str(n)
	l = len(n)
	for i in range(1, l - 1):
		for j in range(i + 1, l):
			k = int(n[:i]) * int(n[i:j]) * int(n[j:l])
			products.append(k)
	return max(products)


maximum_product_of_parts = lambda n: (lambda s: max((int(s[:i]) * int(s[i:j]) * int(s[j:]) for j in range(2, len(s)) for i in range(1, j))))(str(n))


def maximum_product_of_parts(n):
	ns = str(n)
	return max((int(ns[:b]) * int(ns[b:c]) * int(ns[c:]) for a in range(len(ns) - 2) for b in range(a + 1, len(ns) - 1) for c in range(b + 1, len(ns))))


def maximum_product_of_parts(s):
	s = str(s)
	subs = []
	for i in range(1, len(s) - 1):
		for j in range(i + 1, len(s)):
			subs.append([int(x) for x in [s[0:i], s[i:j], s[j:]]])
	return max([x * y * z for [x, y, z] in subs])