Skip to content

Instantly share code, notes, and snippets.

@fielding
Created May 31, 2018 00:51
Show Gist options
  • Save fielding/395406e4bb2eeeecf66803346c56d058 to your computer and use it in GitHub Desktop.
Save fielding/395406e4bb2eeeecf66803346c56d058 to your computer and use it in GitHub Desktop.
function solve(data) {
// example returns sum of a line of integers seperated by a space
// return data.split(' ').reduce((acc, cur) => acc += Number(cur), 0);
return data;
}
process.stdin.resume();
process.stdin.setEncoding('ascii');
let stdin = '';
process.stdin.on('data', function (data) {
stdin += data;
});
process.stdin.on('end', function () {
const stdinArr = stdin.split('\n');
const tests = stdinArr.shift();
let res;
for (let i = 0; i < tests; i += 1) {
res = solve(stdinArr[i]);
process.stdout.write(res + '\n');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment