Main(require("fs").readFileSync("/dev/stdin", "utf8")); function Main(input) { var str; var sum = 0; for (i = 0; i < input.length; i++) { str = input.charAt(i) if (str.charCodeAt() >= 48 && str.charCodeAt() <= 58) { sum += parseInt(str); } } console.log(sum); }