21 lines
708 B
Python
21 lines
708 B
Python
count = 0
|
|
|
|
with open("input.txt", "r") as file:
|
|
for line in file:
|
|
largest = [0] * 12
|
|
index = 0
|
|
print(f"Processing line: {line.strip()}")
|
|
for i in range(12):
|
|
for j in range(index, len(line.strip()) - 11 + i):
|
|
print(f"Comparing {line[j]} and {largest[i]}")
|
|
if int(line[j]) > largest[i]:
|
|
print(f"New largest found: {line[j]} at index {j} for position {i}")
|
|
largest[i] = int(line[j])
|
|
index = j + 1
|
|
|
|
|
|
for i, val in enumerate(largest):
|
|
print(f"Largest at position {i}: {val}")
|
|
count += val * (10 ** (11 - i))
|
|
|
|
print(count) |