31 lines
640 B
Python
31 lines
640 B
Python
data = "172930-683082".split("-")
|
|
|
|
min_, max_ = int(data[0]), int(data[1])
|
|
|
|
|
|
def validate(num):
|
|
repeat = False
|
|
nums = str(num)
|
|
# print(nums)
|
|
for i, c in enumerate(nums):
|
|
if i == len(nums) - 1:
|
|
break
|
|
# print(i, len(nums))
|
|
nextc = nums[i + 1]
|
|
if nextc < c:
|
|
# print(f"not increasing, {nextc} < {c}")
|
|
return False # not increasing
|
|
if c == nextc:
|
|
# print("found repeat")
|
|
repeat = True
|
|
return repeat
|
|
|
|
|
|
matches = 0
|
|
for i in range(min_, max_):
|
|
if validate(i):
|
|
matches += 1
|
|
print(matches)
|
|
|
|
|
|
# print(validate(123466)) |