this time with no legal info
This commit is contained in:
21
3/do2.py
Normal file
21
3/do2.py
Normal file
@@ -0,0 +1,21 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user