题解 | #单词倒排#

单词倒排

https://www.nowcoder.com/practice/81544a4989df4109b33c2d65037c5836

const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;

void (async function () {
    const line = await readline();
    let word = "",
        list = [];
    for (const c of line) {
        if ((c >= "a" && c <= "z") || (c >= "A" && c <= "Z")) {
            word += c;
        } else if (word.length) {
            list.unshift(word);
            word = "";
        }
    }
    if (word.length) list.unshift(word);
    console.log(list.join(" "));
})();

全部评论

相关推荐

在秋招的河老师很爱吃:40岁失业 假如22岁开始工作 18年前 2007年那个时候如何 2015年开始互联网爆发 这个时候有了8年经验 然后黄金10年 你想想这些年挣了多少 这要是进的时候某个大厂 这辈子根本花不完了
你找实习最大的坎坷是什么
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务