I have a list of number:
a = '15235137835692838387'
how to write code output this in python
output = ["1378","3569"]
I have a list of number:
a = '15235137835692838387'
how to write code output this in python
output = ["1378","3569"]
To answer your quite vague question with a brute force solution:
temp, output = a[0], []
for i in range(len(a) - 1):
if a[i] <= a[i+1]:
temp += a[i+1]
else:
if temp:
output.append(temp)
temp = a[i+1]
# Pulling longest value
maxLen = max([len(el) for el in output])
output = [val for val in output if len(val) == maxLen]
# output = ['1378', '3569']