Created
July 1, 2016 19:12
-
-
Save ronen-e/dd05b82231e85dda44dd4db5bc0b6b1d to your computer and use it in GitHub Desktop.
A plus B CLI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| process.stdin.setEncoding('utf8'); | |
| process.stdin.on('data', function (buf) { | |
| var tokens = formatInput(buf); | |
| var a = parseInt(tokens[0]); | |
| var b = parseInt(tokens[1]); | |
| console.log(a+b); | |
| process.exit(); | |
| }); | |
| function formatInput(input) { | |
| return input.trim() | |
| .replace(/\s+/g, ' ') | |
| .split(' ') | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment