Skip to content

Instantly share code, notes, and snippets.

@paladin3895
Last active September 4, 2018 09:54
Show Gist options
  • Save paladin3895/c34dccc83b442752b9d3cad59f9579a0 to your computer and use it in GitHub Desktop.
Save paladin3895/c34dccc83b442752b9d3cad59f9579a0 to your computer and use it in GitHub Desktop.
process.stdin.resume();
process.stdin.setEncoding('utf8');
var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;
process.stdin.on('data', function (data) {
input_stdin += data;
});
process.stdin.on('end', function () {
input_stdin_array = input_stdin.split("\n");
main();
});
function readLine() {
return input_stdin_array[input_currentline++];
}
function print() {
console.log.apply(null, arguments);
}
/////////////// ignore above this line ////////////////////
function greeting() {
if (arguments.length > 0) {
return 'Hello ' + arguments[0];
}
return 'Hello World';
}
// this serve as main entry to implement your solution
function main() {
// write your code here.
// call `readLine()` to read a line.
// use print() to write to stdout
print(
greeting(readLine())
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment