0
私は最近HackerEarthでjavascript(nodejs)をチェックしました。それはすでに書かれた次のコードを持っていた。nodejsの異なるユーザー入力を読み取る方法は?
function main(input) {
//Enter your code here
}
process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";
process.stdin.on("data", function (input) {
stdin_input += input;
});
process.stdin.on("end", function() {
main(stdin_input);
});
私は、このような
A)First line contains no. of test cases and size of array.
Next T lines contains array content.
- 3 4
- 32 33 12 2
- 1 23 34 3
- 65 2 21 11
B)The first line contains the number of testcases, T.
Next, T lines follow each containing a long string S.
- 3
- SUVKITSU
- 651SUVOMN
- SAHJ8HSAU6
としてサンプル入力でテストケースを読むにはどうすればよいので、すべてのすべては、私の質問は、入力された整数や文字列を読み取る方法で、競合するプログラミングをしながらjavascript(nodeJs)の配列?
.split()&.substr()は、特定の長さの文字列をメイン文字列から分割または抽出します。私が欲しいのは、メインストリングを読むことです。 –