const row = require('fs').readFileSync('/dev/stdin','utf8').split('\n'); const str = row[0].split(''); const num = str.filter(e => { return /\d/.test(e); }).map(e => { return Number(e); }) let result = 0; if(num.length > 0){ result = num.reduce((acc, cur) => { return acc + cur; }) } console.log(result);