<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>case Archives - Huahua&#039;s Tech Road</title>
	<atom:link href="https://zxi.mytechroad.com/blog/tag/case/feed/" rel="self" type="application/rss+xml" />
	<link>https://zxi.mytechroad.com/blog/tag/case/</link>
	<description></description>
	<lastBuildDate>Thu, 19 Apr 2018 15:45:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.0.8</generator>

<image>
	<url>https://zxi.mytechroad.com/blog/wp-content/uploads/2017/09/cropped-photo-32x32.jpg</url>
	<title>case Archives - Huahua&#039;s Tech Road</title>
	<link>https://zxi.mytechroad.com/blog/tag/case/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>花花酱 LeetCode 520. Detect Capital</title>
		<link>https://zxi.mytechroad.com/blog/leetcode/leetcode-520-detect-capital/</link>
					<comments>https://zxi.mytechroad.com/blog/leetcode/leetcode-520-detect-capital/#respond</comments>
		
		<dc:creator><![CDATA[zxi]]></dc:creator>
		<pubDate>Sat, 18 Mar 2017 19:44:00 +0000</pubDate>
				<category><![CDATA[Leetcode]]></category>
		<category><![CDATA[case]]></category>
		<category><![CDATA[string]]></category>
		<guid isPermaLink="false">http://zxi.mytechroad.com/blog/?p=28</guid>

					<description><![CDATA[<p>Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in&#8230;</p>
<p>The post <a rel="nofollow" href="https://zxi.mytechroad.com/blog/leetcode/leetcode-520-detect-capital/">花花酱 LeetCode 520. Detect Capital</a> appeared first on <a rel="nofollow" href="https://zxi.mytechroad.com/blog">Huahua&#039;s Tech Road</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Given a word, you need to judge whether the usage of capitals in it is right or not.</p>
<p>We define the usage of capitals in a word to be right when one of the following cases holds:</p>
<ol>
<li>All letters in this word are capitals, like &#8220;USA&#8221;.</li>
<li>All letters in this word are not capitals, like &#8220;leetcode&#8221;.</li>
<li>Only the first letter in this word is capital if it has more than one letter, like &#8220;Google&#8221;.</li>
</ol>
<p>Otherwise, we define that this word doesn&#8217;t use capitals in a right way.</p>
<p><b>Example 1:</b></p><pre class="crayon-plain-tag">&lt;b&gt;Input:&lt;/b&gt; &quot;USA&quot;
&lt;b&gt;Output:&lt;/b&gt; True</pre><p><b>Example 2:</b></p><pre class="crayon-plain-tag">&lt;b&gt;Input:&lt;/b&gt; &quot;FlaG&quot;
&lt;b&gt;Output:&lt;/b&gt; False</pre><p><b>Note:</b> The input will be a non-empty word consisting of uppercase and lowercase latin letters.</p><pre class="crayon-plain-tag">class Solution {
public:
    bool detectCapitalUse(string word) {
        int n = std::count_if(word.begin(), word.end(), ::isupper);
        return n == 0 || (n == 1 &amp;&amp; isupper(word[0])) || n == word.length();
    }
};</pre><p>&nbsp;</p>
<p>The post <a rel="nofollow" href="https://zxi.mytechroad.com/blog/leetcode/leetcode-520-detect-capital/">花花酱 LeetCode 520. Detect Capital</a> appeared first on <a rel="nofollow" href="https://zxi.mytechroad.com/blog">Huahua&#039;s Tech Road</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://zxi.mytechroad.com/blog/leetcode/leetcode-520-detect-capital/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
