描述
对于给定的由大小写字母和数字组成的字符串,请按照 ASCII 码值将其从小到大排序。
如果您需要了解更多关于 ASCII 码的知识,请参考下表。
输入描述:
在一行上输入一个长度为 1≦length(s)≦103 ,仅由大小写字母和数字构成的字符串 s ,代表输入的字符串。
输出描述:
在一行上输出一个字符串 s ,代表排序后的答案。
const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;
void (async function () {
// Write your code here
while ((line = await readline())) {
let tokens = line
.split("")
.map((i) => i.charCodeAt())
.sort((a, b) => a - b)
.map((i) => String.fromCharCode(i))
.join("");
console.log(tokens);
}
})();