14 lines
237 B
Fish
14 lines
237 B
Fish
|
set sum 0
|
||
|
for line in $(cat input.txt)
|
||
|
set first $(string match -gr "(\d)" $line)
|
||
|
set last $(string match -gr "(\d)(?!.*\d)" $line)
|
||
|
echo $line
|
||
|
|
||
|
set n $first$last
|
||
|
set sum $(math $sum + $n)
|
||
|
|
||
|
echo "-"
|
||
|
end
|
||
|
|
||
|
echo $sum
|