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)/检测大写字母 [detect-capital].html
2022-03-29 12:43:11 +08:00

35 lines
944 B
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>我们定义,在以下情况时,单词的大写用法是正确的:</p>
<ul>
<li>全部字母都是大写,比如 <code>"USA"</code></li>
<li>单词中所有字母都不是大写,比如 <code>"leetcode"</code></li>
<li>如果单词不只含有一个字母,只有首字母大写,&nbsp;比如&nbsp;<code>"Google"</code></li>
</ul>
<p>给你一个字符串 <code>word</code> 。如果大写用法正确,返回 <code>true</code> ;否则,返回 <code>false</code></p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>word = "USA"
<strong>输出:</strong>true
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>word = "FlaG"
<strong>输出:</strong>false
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= word.length &lt;= 100</code></li>
<li><code>word</code> 由小写和大写英文字母组成</li>
</ul>