题解 | 图片整理
const rl = require("readline").createInterface({ input: process.stdin }); var iter = rl[Symbol.asyncIterator](); const readline = async () => (await iter.next()).value; void (async function () { function sortStringByASCII(str) { // 将字符串拆分为字符数组 const string = str.split(""); // 使用数组的sort方法,根据ASCII码值排序 string.sort((a, b) => a.charCodeAt(0) - b.charCodeAt(0)); // 将排序后的字符数组重新组合成字符串 return string.join(""); } let input = await readline(); console.log(sortStringByASCII(input)) })();