1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/反转字符串中的单词 III [reverse-words-in-a-string-iii].html

30 lines
1.0 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给定一个字符串<meta charset="UTF-8" />&nbsp;<code>s</code>&nbsp;,你需要反转字符串中每个单词的字符顺序,同时仍保留空格和单词的初始顺序。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>s = "Let's take LeetCode contest"
<strong>输出:</strong>"s'teL ekat edoCteeL tsetnoc"
</pre>
<p><strong>示例 2:</strong></p>
<pre>
<strong>输入:</strong> s = "Mr Ding"
<strong>输出:</strong>"rM gniD"
</pre>
<p>&nbsp;</p>
<p><strong><strong><strong><strong>提示:</strong></strong></strong></strong></p>
<ul>
<li><code>1 &lt;= s.length &lt;= 5 * 10<sup>4</sup></code></li>
<li><meta charset="UTF-8" /><code>s</code>&nbsp;包含可打印的 <strong>ASCII</strong> 字符。</li>
<li><meta charset="UTF-8" /><code>s</code>&nbsp;不包含任何开头或结尾空格。</li>
<li><meta charset="UTF-8" /><code>s</code>&nbsp;<strong>至少</strong> 有一个词。</li>
<li><meta charset="UTF-8" /><code>s</code>&nbsp;中的所有单词都用一个空格隔开。</li>
</ul>