Last active
June 25, 2023 18:12
-
-
Save Nusab19/c2fba6d26ed2af85291bb7042e5f83e4 to your computer and use it in GitHub Desktop.
Take input in NodeJS for Online Judges. This is the long 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 | |
// Minimized Version: https://gist.github.com/Nusab19/fc8d96ae73a910acb8403758dc41f8c5 | |
// Do not change anything from here.... | |
let _inputData = ""; | |
let _inputArray = []; | |
let _count = -1; | |
process.stdin.setEncoding("utf8"); | |
process.stdin.on("data", function (chunk) { | |
_inputData += chunk; | |
}); | |
process.stdin.on("end", function () { | |
_inputArray = _inputData.split("\n"); | |
input(); | |
main(); | |
}); | |
function input() { | |
let line = _inputArray[_count]; | |
_count++; | |
return line; | |
} | |
// Till here..... | |
// 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