File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed
solution/0500-0599/0557.Reverse Words in a String III Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change 6
6
7
7
<!-- 这里写题目描述 -->
8
8
9
- <p >给定一个字符串,你需要反转字符串中每个单词的字符顺序,同时仍保留空格和单词的初始顺序。</p >
9
+ <p >给定一个字符串< meta charset = \"UTF-8\" /> & nbsp ; < code >s</ code > & nbsp ; ,你需要反转字符串中每个单词的字符顺序,同时仍保留空格和单词的初始顺序。</p >
10
10
11
11
<p >  ; </p >
12
12
13
- <p ><strong >示例:</strong ></p >
13
+ <p ><strong >示例 1 :</strong ></p >
14
14
15
- <pre ><strong >输入:</strong >" ; Let' ; s take LeetCode contest" ;
16
- <strong >输出:</strong >" ; s' ; teL ekat edoCteeL tsetnoc" ;
15
+ <pre >
16
+ <strong >输入:</strong >s = "Let's take LeetCode contest"
17
+ <strong >输出:</strong >"s'teL ekat edoCteeL tsetnoc"
18
+ </pre >
19
+
20
+ <p ><strong >示例 2:</strong ></p >
21
+
22
+ <pre >
23
+ <strong >输入:</strong > s = "God Ding"
24
+ <strong >输出:</strong >"doG gniD"
17
25
</pre >
18
26
19
27
<p >  ; </p >
20
28
21
29
<p ><strong ><strong ><strong ><strong >提示:</strong ></strong ></strong ></strong ></p >
22
30
23
31
<ul >
24
- <li>在字符串中,每个单词由单个空格分隔,并且字符串中不会有任何额外的空格。</li>
32
+ <li><code>1 <= s.length <= 5 * 10<sup>4</sup></code></li>
33
+ <li><meta charset=\"UTF-8\" /><code>s</code> 包含可打印的 <strong>ASCII</strong> 字符。</li>
34
+ <li><meta charset=\"UTF-8\" /><code>s</code> 不包含任何开头或结尾空格。</li>
35
+ <li><meta charset=\"UTF-8\" /><code>s</code> 里 <strong>至少</strong> 有一个词。</li>
36
+ <li><meta charset=\"UTF-8\" /><code>s</code> 中的所有单词都用一个空格隔开。</li>
25
37
</ul >
26
38
27
39
## 解法
You can’t perform that action at this time.
0 commit comments