1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 19:18:14 +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 Normal View History

2022-03-27 20:46:41 +08:00
<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 = "God Ding"
<strong>输出:</strong>"doG 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>