## Task

Complete function `splitOddAndEven`, accept a number `n`(n>0), return an array that contains the continuous parts of odd or even digits.

Please don't worry about digit `0`, it won't appear ;-)

## Examples

Source: codewars | Difficulty: EASY
Tags: Game theory

Ad-hoc

Starter code: def split_odd_and_even(n):
	

Solutions:
def split_odd_and_even(n):
	import re
	return [int(i) for i in re.findall('[2468]+|[13579]+', str(n))]


from itertools import groupby

def split_odd_and_even(n):
	return [int(''.join(g)) for (i, g) in groupby(str(n), key=lambda x: int(x) % 2)]


def split_odd_and_even(n):
	new_n = ''
	for c in str(n):
		if not new_n or not (int(new_n[-1]) - int(c)) % 2:
			new_n += c
		else:
			new_n += '.' + c
	return [int(i) for i in new_n.split('.')]


def is_even(n):
	return int(n) % 2 == 0

def split_odd_and_even(n):
	(index, s) = (0, str(n))
	l = [[s[0]]]
	for x in s[1:]:
		if is_even(x) and is_even(l[index][-1]):
			l[index].append(x)
		elif not is_even(x) and (not is_even(l[index][-1])):
			l[index].append(x)
		else:
			l.append([x])
			index += 1
	return [int(''.join(x)) for x in l]


from itertools import groupby

def split_odd_and_even(n):
	return [int(''.join(list(gp))) for (_, gp) in groupby(str(n), key=lambda x: int(x) % 2)]


import re

def split_odd_and_even(n):
	return [int(group[0] or group[1]) for group in re.findall('([13579]+)|([2468]+)', str(n))]


from itertools import groupby

def split_odd_and_even(n):
	return [int(''.join((str(b) for b in g))) for (k, g) in groupby((int(a) for a in str(n)), key=lambda b: b % 2)]