21 lines
405 B
Python
21 lines
405 B
Python
with open("./day1a/inputs.txt", "r") as file:
|
|
inputs = file.read().strip().split()
|
|
|
|
value = sum(
|
|
map(
|
|
lambda nums: int(
|
|
"".join([nums[0], nums[-1]]),
|
|
)
|
|
if len(nums) >= 2
|
|
else int(
|
|
"".join(nums * 2),
|
|
),
|
|
map(
|
|
lambda text: [c for c in text if c.isdigit()],
|
|
inputs,
|
|
),
|
|
)
|
|
)
|
|
|
|
print(f"{value=}")
|