1每日一题 # 翻转句子中的单词顺序

56 阅读1分钟

题目描述

输入一个英文句子,翻转句子中单词的顺序,但单词内字符的顺序不变和普通字母一样处理。

示例1

输入 the sky is bule
输出 blue is sky the

示例2

输入 hello world
输出 world hello

javascript

str = 'you are my best'
str.split(" ").reverse().join(" ")
// 输出 'best my are you'