In this Kata, you will be given a string that has lowercase letters and numbers. Your task is to compare the number groupings and return the largest number. Numbers will not have leading zeros. 

For example, `solve("gh12cdy695m1") = 695`, because this is the largest of all number groupings. 

Good luck!

Please also try [Simple remove duplicates](https://www.codewars.com/kata/5ba38ba180824a86850000f7)

Source: codewars | Difficulty: EASY
Tags: String algorithms

Starter code: def solve(s):
	

Solutions:
import re

def solve(s):
	return max(map(int, re.findall('(\\d+)', s)))


def solve(s):
	largest = 0
	number = 0
	for char in s:
		if char.isdigit():
			number = number * 10 + int(char)
			if largest < number:
				largest = number
		else:
			number = 0
	return largest


import re

def solve(s):
	return max(map(int, re.findall('\\d+', s)), default=0)


def solve(s):
	return max(map(int, ''.join((' ' if x.isalpha() else x for x in s)).split()))


def solve(s):
	result = [0]
	for c in s:
		if '0' <= c <= '9':
			result[-1] = result[-1] * 10 + int(c)
		elif result[-1] > 0:
			result.append(0)
	return max(result)


def solve(s):
	breakdown = [0]
	for i in s:
		if i in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']:
			breakdown[-1] = breakdown[-1] * 10 + int(i)
		elif breakdown[-1] != 0:
			breakdown.append(0)
	breakdown.sort()
	return breakdown[-1]


import re

def solve(s):
	return max([int(i) for i in re.compile('[a-z]').split(s) if i != ''])


import re
P = re.compile('\\d+')
solve = lambda s: max(map(int, P.findall(s)))


import re

def solve(s):
	reg = '(\\+?\\-?\\ *\\d+\\.?\\d*)'
	return max(map(float, re.findall(reg, s)))


import re

def solve(s):
	return max((int(x) for x in re.findall('[\\d]+', s)))


solve = lambda s: max(map(int, ''.join((c if c in '0123456789' else ' ' for c in s)).split()))


import re

def solve(s):
	return max(map(int, re.findall('[0-9]+', s)))


def solve(s):
	new_list = []
	number = ''
	for characters in s:
		if characters.isdigit():
			number += characters
		elif number != '':
			new_list.append(int(number))
			number = ''
	if number != '':
		new_list.append(int(number))
	return max(new_list)


solve = lambda s: max(map(int, __import__('re').findall('\\d+', s)))


def solve(s):
	alphabet = 'abcdefghijklmnopqrstuvwxyz'
	ans = ''
	for char in s:
		if char in alphabet:
			ans += ' '
		else:
			ans += char
	ans = ans.split(' ')
	return max((int(x) for x in ans if x))


def solve(s):
	w = ''.join(['*' if i.isalpha() else i for i in s])
	num = [int(i) for i in w.split('*') if i]
	return max(num)


def solve(s):
	k = 0
	a = ''
	talha = []
	for i in s:
		if i.isalpha() == True:
			a = a + 'x'
		else:
			a = a + i
	b = a.split('x')
	for i in b:
		if i.isdigit() == True:
			talha.append(int(i))
	return max(talha)


def solve(s):
	return max([int(i) for i in ''.join([i if i.isdigit() else ' ' for i in s]).split()])


def solve(s):
	return max(map(int, [c for c in ''.join([v if not v.isalpha() else '|' for v in s]).split('|') if c != '']))


def solve(s):
	max = num = 0
	for char in s:
		if char.isdigit():
			num = num * 10 + int(char)
			if max < num:
				max = num
		else:
			num = 0
	return max


from re import findall
solve = lambda s: max((int(m) for m in findall('\\d+', s)))


def solve(s):
	for i in s:
		if i.isalpha():
			s = s.replace(i, ' ')
	lst = s.split()
	largest = 0
	for w in lst:
		if int(w) > largest:
			largest = int(w)
	return largest


def solve(s):
	for i in s:
		if i not in '0123456789':
			s = s.replace(i, ' ')
	s = s.split()
	return sorted([int(i) for i in s])[-1]


def solve(s):
	return max((int(x) for x in ''.join((c if c in '0123456789' else ' ' for c in s)).split()))


def solve(s):
	return max(find_numbers(s))

def find_numbers(chaos):
	numbers = []
	buffer = []
	for char in chaos:
		if char.isnumeric():
			buffer.append(char)
		elif char.isalpha() and buffer:
			numbers.append(int(''.join(buffer)))
			buffer = []
	if buffer:
		numbers.append(int(''.join(buffer)))
	return numbers


import re

def solve(s):
	s = re.sub('[^0-9]+', 'x', s)
	l = s.split('x')
	res = []
	for i in l:
		if i is '':
			pass
		elif i.isnumeric:
			res.append(int(i))
	return max(res)


import re

def solve(s):
	x = re.findall('[0-9]+', s)
	result = list(map(int, x))
	return max(result)


def solve(s):
	s += 'a'
	digits = list('0123456789')
	biggest = 0
	current = ''
	list_of_numbers = []
	for i in range(len(s)):
		if s[i] in digits:
			current += s[i]
		else:
			list_of_numbers.append(current)
			current = ''
	while '' in list_of_numbers:
		list_of_numbers.remove('')
	list_of_ints = []
	for j in range(len(list_of_numbers)):
		list_of_numbers[j] = int(list_of_numbers[j])
		list_of_ints.append(list_of_numbers[j])
	biggest = max(list_of_ints)
	return biggest
pass


def solve(s):
	highest = 0
	temp = ''
	for char in s:
		if char.isnumeric():
			temp += char
		else:
			if temp != '' and int(temp) >= highest:
				highest = int(temp)
			temp = ''
	return highest if temp == '' or highest > int(temp) else int(temp)


import re

def solve(s):
	zahlen = re.findall('([0-9]*)', s)
	liste = [feld for feld in zahlen if feld != '']
	results = list(map(int, liste))
	return max(results)


from re import findall

def solve(s):
	return max(map(int, findall('[\\d]{1,}', s)))


import re

def solve(s):
	array = re.findall('[0-9]+', s)
	x = [int(i) for i in array]
	x.sort()
	return x[-1]


import re

def solve(s):
	list_numbers = re.sub('[^0-9]', ' 0 ', s)
	return max([int(i) for i in list_numbers.split()])


import re

def solve(s):
	kill = [int(x) for x in re.findall('[0-9]*', s) if x != '']
	return sorted(kill, reverse=True)[0]


def solve(s):
	max_int = -1
	current_num = ''
	for char in s:
		if char in '0123456789':
			current_num += char
			max_int = max(max_int, int(current_num))
		else:
			current_num = ''
	return max_int


def solve(s):
	arr = []
	for i in s:
		if i.isalpha():
			arr.append('*')
		else:
			arr.append(i)
	strr = ''.join(arr)
	arr = strr.split('*')
	return max([int(i) for i in arr if i != ''])


def solve(s):
	max = float('-inf')
	s = list(s)
	word = ' '
	for ch in s:
		if ch.isnumeric():
			word += ch
		if not ch.isnumeric():
			word += ' '
	lists = word.split(' ')
	for value in lists:
		if value.isnumeric():
			if int(value) > max:
				max = int(value)
		else:
			pass
	return max


import re

def solve(string):
	return max(map(int, re.findall('[\\d]+', string)))


def solve(s):
	max = 0
	for i in range(len(s)):
		if s[i].isnumeric():
			k = ''
			for j in range(i, len(s)):
				if s[j].isnumeric():
					k += s[j]
					if max < int(k):
						max = int(k)
				else:
					if max < int(k):
						max = int(k)
					break
	return max


import re

def solve(s):
	return max([int(i) for i in re.split('[^0-9]', s) if i != ''])


import re

def solve(s):
	x = re.findall('\\d+', s)
	x = list(map(int, x))
	return max(x)


def solve(s):
	end = ''
	for i in range(1, len(s)):
		if s[i - 1].isdigit():
			end += s[i - 1]
			if s[i].isalpha():
				end += ','
		if i == len(s) - 1 and s[i].isdigit():
			end += s[i]
	return max(sorted([int(i) for i in end.split(',') if i != '']))


def solve(s):
	numbers = '0123456789'
	num = []
	str = ''
	for i in s:
		if i in numbers:
			str += i
		elif str != '':
			num.append(str)
			str = ''
	if str != '':
		num.append(str)
	return max([int(i) for i in num])


import re

def solve(s):
	nums = re.findall('\\d+', s)
	nums = [int(i) for i in nums]
	return max(nums)


def solve(s):
	for letter in s:
		if letter.isdigit():
			pass
		else:
			s = s.replace(letter, ' ')
	numberList = map(int, s.split())
	return max(numberList)


def solve(s):
	ans = [0]
	for char in s:
		if '0' <= char <= '9':
			ans[-1] = ans[-1] * 10 + int(char)
		elif ans[-1] > 0:
			ans.append(0)
	return max(ans)


def solve(s):
	import re
	numbers = re.findall('\\d+', s)
	int_numbers = [int(i) for i in numbers]
	return max(int_numbers)


def solve(number):
	numb_list = []
	temp = ''
	int_mun = []
	for numb in number:
		if not numb.isdigit():
			numb_list.append(' ')
		elif numb.isdigit():
			numb_list.append(numb)
			temp = sorted(''.join(numb_list).split())
	for el in temp:
		el = int(el)
		int_mun.append(el)
	return sorted(int_mun)[-1]


def solve(s):
	str_num = ''
	num_fin = 0
	j_count = 0
	len_s = len(s)
	for a in s:
		if a.isdigit():
			str_num = str_num + a
		if (not a.isdigit() or j_count == len_s - 1) and str_num != '':
			num_fin = max(int(str_num), num_fin)
			str_num = ''
		j_count = j_count + 1
	return num_fin


def solve(s):
	outl = []
	s += ' '
	for el in s:
		if el.isdecimal():
			outl.append(el)
		else:
			outl.append(' ')
	temp = ''
	lis = []
	for i in range(len(outl) - 1):
		if outl[i].isdecimal():
			temp += outl[i]
			if outl[i + 1] == ' ':
				lis.append(int(temp))
				temp = ''
	return max(lis)


def solve(s):
	r = [',' if x in 'qwertyuioplkjhgfdsazxcvbnm' else x for x in s]
	t = list(filter(lambda x: x != '', ''.join(r).split(',')))
	return max(list(map(lambda x: int(x), t)))


import re

def solve(s):
	return max((int(x) for x in re.split('\\D+', s) if x.isnumeric()))


def solve(s):
	t = ''.join([i if i.isnumeric() else ' ' for i in s])
	return max([int(i) for i in t.split(' ') if i])


def solve(s):
	for n in s:
		if n.isnumeric() == False:
			s = s.replace(n, ' ')
	lst = s.split()
	lst = [int(x) for x in lst]
	return max(lst)


def solve(s):
	number = 0
	lst = []
	last = 0
	for i in range(len(s)):
		if s[i].isnumeric():
			if last == i - 1:
				number = number * 10 + int(s[i])
				last = i
			else:
				lst.append(number)
				number = int(s[i])
				last = i
	lst.append(number)
	return max(lst)


def solve(s):
	substr = ''
	sub_list = []
	prev_digit = s[0].isdigit()
	for char in s:
		this_digit = char.isdigit()
		if this_digit != prev_digit:
			sub_list.append(substr)
			substr = ''
			prev_digit = this_digit
		substr += char
	sub_list.append(substr)
	list_of_numbers = []
	final_list = [s for s in sub_list if s.isdigit()]
	high = max(map(int, final_list))
	return high


import re

def solve(s):
	temp = re.findall('\\d+', s)
	erg = list(map(int, temp))
	return int(max(erg))


def solve(s):
	str_lst = []
	temp = ''
	for elem in s:
		if elem.isdigit():
			temp += elem
		elif not elem.isdigit() and temp != '':
			str_lst.append(temp)
			temp = ''
	str_lst.append(temp) if temp != '' else False
	maximum = max([int(elem) for elem in str_lst])
	return maximum


def solve(s):
	n = ''
	ls = []
	for i in s:
		if i.isnumeric():
			n += i
		elif n != '':
			ls.append(n)
			n = ''
	if n != '':
		ls.append(n)
	return max(map(float, ls))


def solve(s):
	clean = ''.join([str(c) if c.isdigit() else ' ' for c in s])
	return max(list([int(x) for x in list([_f for _f in clean.split(' ') if _f])]))


def solve(s):
	a = ''
	b = 0
	for i in s:
		if i.isdigit():
			a += i
		if not i.isdigit():
			if not a == '':
				b = max(int(a), int(b))
				a = ''
	if not a == '':
		return max(int(a), int(b))
	else:
		return int(b)


def solve(s):
	int_temp = []
	int_store = []
	for i in range(len(s)):
		try:
			int(s[i])
			int_temp.append(s[i])
			if i == len(s) - 1:
				int_store.append(''.join(int_temp))
		except:
			if int_temp == '':
				int_temp = []
			else:
				int_store.append(''.join(int_temp))
				int_temp = []
	int_clean = [int(x) for x in int_store if x not in '']
	return int(sorted(int_clean, reverse=True)[0])


import re

def solve(s):
	elements = re.split('[azertyuiopqsdfghjklmwxcvbn]', s)
	return max([int(coordinates) for coordinates in elements if len(coordinates) > 0])


def solve(s):
	string = ''
	for (i, item) in enumerate(s):
		if item.isalpha():
			string += ' '
		else:
			string += item
	numbers = string.split()
	numbers = [int(i) for i in numbers]
	return max(numbers)


def solve(s):
	longest_number = '0'
	number_sequence = '0'
	for x in s:
		if x.isalpha() is False:
			number_sequence = number_sequence + x
			if int(number_sequence) > int(longest_number):
				longest_number = number_sequence
		else:
			number_sequence = ''
	return int(longest_number)


def solve(s):
	return max(map(int, ''.join((elem if elem.isdigit() else ' ' for elem in s)).split()))


import re

def solve(s):
	return max((int(n or '0') for n in re.split('[a-z]+', s)))


def solve(s) -> str:
	naujas_listas = split(s)
	return max(naujas_listas)

def split(tekstas) -> list:
	groups = []
	newword = ''
	for (x, i) in enumerate(tekstas[0:]):
		if i.isnumeric():
			newword += i
		elif newword != '':
			groups.append(int(newword))
			newword = ''
	if newword != '':
		groups.append(int(newword))
	return groups


def solve(s):
	return max([int(s) for s in ''.join([c if '9' >= c >= '0' else ' ' for c in s]).split()])


def solve(arr):
	l = len(arr)
	integ = []
	i = 0
	while i < l:
		s_int = ''
		a = arr[i]
		while '0' <= a <= '9':
			s_int += a
			i += 1
			if i < l:
				a = arr[i]
			else:
				break
		i += 1
		if s_int != '':
			integ.append(int(s_int))
	return max(integ)


import re

def solve(s):
	reg = re.compile('\\d+')
	ans = reg.findall(s)
	val = 0
	holder = [int(x) for x in ans]
	for ele in holder:
		if ele > val:
			val = ele
	return val
	pass


def solve(s):
	digits = '0123456789'
	res = []
	temp_nums = ''
	for i in s:
		if i in digits:
			temp_nums += i
		if i not in digits:
			if len(temp_nums) > 0:
				res += [int(temp_nums)]
			temp_nums = ''
	if len(temp_nums) > 0:
		res += [int(temp_nums)]
	return max(res)


def solve(s):
	nums = []
	num = ''
	for letter in s + 'k':
		if letter.isalpha():
			print(num, letter)
			if num != '':
				nums.append(int(num))
			num = ''
		if letter.isalpha() == False:
			print(letter)
			num += letter
	return max(nums)


def solve(s):
	l = []
	num = ''
	alp = 'a b c d e f g h i j k l m n o p q r s t u v w x y z'
	for i in s:
		if i not in alp:
			num += i
		if i in alp:
			if len(num) == 0:
				continue
			else:
				l.append(int(num))
				num = ''
	if len(num) > 0:
		l.append(int(num))
	return max(l)


def solve(s):
	s = s + 'd'
	t = []
	d = ''
	for i in range(len(s) - 1):
		if s[i].isdigit():
			d = d + s[i]
			if s[i + 1].isalpha():
				t.append(int(d))
				d = ''
	return max(t)


def solve(s):
	max_num = float('-inf')
	temp = ''
	for i in s:
		if i.isdigit():
			temp += i
			max_num = max(max_num, int(temp))
		else:
			temp = ''
	return max_num


def solve(s):
	lst = []
	i = 0
	while len(s) > i:
		if s[i].isdigit():
			lst.append(s[i])
			i += 1
		else:
			lst.append('*')
			i += 1
	lst = ''.join(lst)
	lst = lst.replace('*', ' ')
	lst = lst.split()
	lst = list(map(int, lst))
	return max(lst)


def solve(a):
	b = [0] * len(a)
	c = 0
	for i in a:
		if i.isalpha():
			a = a.replace(i, ' ')
	a = a.split()
	for x in range(len(a)):
		b[x] = int(a[x])
		c += 1
	return max(b)


def solve(s):
	mas2 = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
	mas = []
	k = ''
	for i in range(len(s)):
		if s[i] in mas2:
			k = k + s[i]
			if i == len(s) - 1:
				mas.append(int(k))
		elif k != '':
			mas.append(int(k))
			k = ''
	return max(mas)


def solve(s):
	char = 'abcdefghijklmnopqrstuvwxyz'
	ans = ''
	answer = []
	for i in s:
		if i in char:
			ans += ' '
		else:
			ans += i
	ans = ans.split(' ')
	while ans.count('') != 0:
		ans.remove('')
	for i in ans:
		i = int(i)
		answer.append(i)
	return max(answer)


def solve(s):
	res = []
	temp = list(s)
	max = 0
	for item in temp:
		if item.isalpha():
			res.append(' ')
		else:
			res.append(item)
	res = ''.join(res).split(' ')
	for item in res:
		if item != '' and int(item) > max:
			max = int(item)
	return max


def solve(s):
	import re
	return max([int(i) for i in re.split('(\\d+)', s) if i.isnumeric()])


def solve(s):
	import re
	lst = [i for i in re.split('(\\d+)', s) if i.isnumeric()]
	max_num = 0
	for l in lst:
		if int(l) > max_num:
			max_num = int(l)
	return max_num


def solve(s):
	next_number = 0
	largest_number = 0
	for char in s:
		if str.isnumeric(char):
			next_number = int(str(next_number) + str(char))
		else:
			if next_number > largest_number:
				largest_number = next_number
			next_number = 0
	if next_number > largest_number:
		largest_number = next_number
	return largest_number
print(solve('lu1j8qbbb85'))


def isNumber(char):
	if char in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']:
		return True
	else:
		return False

def solve(s):
	max_number = 0
	new_number = []
	for char in s:
		if isNumber(char):
			new_number.append(char)
		else:
			if new_number != []:
				k = int(''.join(new_number))
				if k > max_number:
					max_number = k
			new_number = []
	if new_number != []:
		k = int(''.join(new_number))
		if k > max_number:
			max_number = k
	return max_number


def solve(s):
	s += '.'
	arr = []
	num = ''
	for i in s:
		if i.isnumeric():
			num += i
		else:
			if num != '':
				arr.append(int(num))
			num = ''
	arr.sort()
	return arr[-1]


import re

def solve(s):
	b = re.findall('[0-9]+', s)
	return max([int(i) for i in b])


import re

def solve(s):
	x = re.findall('[0-9]+', s)
	list = []
	for i in x:
		list.append(int(i))
	return max(list)


def solve(s):
	nums = 0
	for char in s:
		if char.isdigit():
			pass
		else:
			s = s.replace(char, ' ')
	result_list = s.split()
	for i in range(len(result_list)):
		result_list[i] = int(result_list[i])
	return max(result_list)


def solve(s):
	numbers = []
	temp = ''
	for char in s:
		if char.isnumeric():
			temp += char
			numbers.append(int(temp))
		else:
			try:
				numbers.append(int(temp))
				temp = ''
			except:
				continue
	return max(numbers)