part 1
This commit is contained in:
commit
d4fa8165f0
3 changed files with 1017 additions and 0 deletions
4
example.txt
Normal file
4
example.txt
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
1abc2
|
||||||
|
pqr3stu8vwx
|
||||||
|
a1b2c3d4e5f
|
||||||
|
treb7uchet
|
13
solve.py
Normal file
13
solve.py
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
import sys
|
||||||
|
import re
|
||||||
|
|
||||||
|
sum = 0
|
||||||
|
for line in sys.stdin:
|
||||||
|
line = re.sub(r'[^\d]', '', line)
|
||||||
|
first = line[0]
|
||||||
|
last = line[-1]
|
||||||
|
value = int(first + last)
|
||||||
|
sum += value
|
||||||
|
|
||||||
|
print(sum)
|
||||||
|
|
Loading…
Reference in a new issue