let main = (standardInput) => { var moji = standardInput.trim(); var moji2 = moji.replace(/[^0-9]/g, ''); var array = moji2.split('').map(Number); var sum = array.reduce(function (accumulator, currentValue) { return accumulator + currentValue; }, 0); console.log(sum); }; main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));