题解 | #单词倒排#
单词倒排
http://www.nowcoder.com/practice/81544a4989df4109b33c2d65037c5836
灵活使用正则,提高工作效率
while(line = readline()) {
const newLine = line.replace(/[^a-zA-Z]/g, ' ').replace(/(\s)\1{2,}/g, ' ')
const words = newLine.split(' ');
const sortWs = words.reverse();
print(sortWs.join(' '))
}
