33 lines
499 B
Python
33 lines
499 B
Python
|
|
||
|
def findFirstAndLastInt(inp):
|
||
|
first = 0
|
||
|
last = 0
|
||
|
for i in inp:
|
||
|
if i.isdigit():
|
||
|
if first == 0:
|
||
|
first = i
|
||
|
else:
|
||
|
last = i
|
||
|
if last == 0:
|
||
|
last = first
|
||
|
|
||
|
return int(first), int(last)
|
||
|
|
||
|
|
||
|
def main():
|
||
|
inputs = []
|
||
|
with open("input.in", "r") as f:
|
||
|
for line in f:
|
||
|
inputs.append(line.strip())
|
||
|
|
||
|
s = 0
|
||
|
for inp in inputs:
|
||
|
first, last = findFirstAndLastInt(inp)
|
||
|
s += first*10 + last
|
||
|
|
||
|
print(s)
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
main()
|