21 lines
492 B
Python
21 lines
492 B
Python
text: str
|
|
|
|
with open("input.txt") as f:
|
|
text = f.read()
|
|
|
|
total: int = 0
|
|
|
|
for line in text.splitlines():
|
|
lst = [int(char) for char in line]
|
|
result: str = ""
|
|
start_index: int = 0
|
|
for i in range(0, 12):
|
|
stop_index: int = i - 11 if i != 11 else len(lst)
|
|
sublst = lst[start_index:stop_index]
|
|
max_value = max(sublst)
|
|
result += str(max_value)
|
|
start_index = start_index + sublst.index(max_value) + 1
|
|
total += int(result)
|
|
|
|
|
|
print(total) |