Split and sum in string



Problem to split and sum the numbers in given string.



Example-1:


Input    : s = "123helloworld45welcome17to5python10"
Output   : 200 
Explain  : 123+45+17+5+10 = 200. 


Example-2:


Input    : s = "23my7crazy20coding15"
Output   : 65 
Explain  : 23+7+20+15 = 65.







Solution





import re

a = "123helloworld45welcome17to5python10"

n = re.findall('[0-9]+',a)

l = [int(x) for x in n]

print(sum(l))



Output



200