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)/连续字符 [consecutive-characters].html

31 lines
855 B
HTML
Raw Normal View History

2022-03-27 20:37:52 +08:00
<p>给你一个字符串&nbsp;<code>s</code>&nbsp;,字符串的<strong>「能量」</strong>定义为:只包含一种字符的最长非空子字符串的长度。</p>
<p>请你返回字符串 <code>s</code><strong>能量</strong></p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>s = "leetcode"
<strong>输出:</strong>2
<strong>解释:</strong>子字符串 "ee" 长度为 2 ,只包含字符 'e' 。
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>s = "abbcccddddeeeeedcba"
<strong>输出:</strong>5
<strong>解释:</strong>子字符串 "eeeee" 长度为 5 ,只包含字符 'e' 。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= s.length &lt;= 500</code></li>
<li><code>s</code>&nbsp;只包含小写英文字母。</li>
</ul>