Last active
June 25, 2023 18:11
-
-
Save Nusab19/fc8d96ae73a910acb8403758dc41f8c5 to your computer and use it in GitHub Desktop.
Take input in NodeJS for Online Judges. This is the short version.
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
// Credit: Nusab Taha @Nusab19 | |
// Gist: https://gist.github.com/Nusab19/fc8d96ae73a910acb8403758dc41f8c5 | |
let _inputData="",_inputArray=[],_count=-1;function input(){let n=_inputArray[_count];return _count++,n}process.stdin.setEncoding("utf8"),process.stdin.on("data",(function(n){_inputData+=n})),process.stdin.on("end",(function(){_inputArray=_inputData.split("\n"),input(),main()})); | |
// You need to code everything in this main function. | |
function main() { | |
// input function will return a `string` or `undefined`. | |
// `undefined` means there's no more input left. | |
let a = input(); | |
let b = input(); | |
let c = input(); | |
console.log(a, b, c); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment