aboutsummaryrefslogtreecommitdiff
path: root/challenge-113/abigail/node/ch-2.js
blob: 606e95d09dbc7993ff4680cdcbc19d9a6dbfa5b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/local/bin/node

//
// See ../README.md
//

//
// Run as: node ch-2.js < input-file
//

require ('readline')
. createInterface ({input: process . stdin})   
. on ('line', _ => {
    let numbers = _ . split (/\s+/) . map (_ => +_)
    let sum     = numbers . reduce ((acc, val) => acc + val)
    console . log (numbers . map (_ => sum - _) . join (" "))
})