Consecutive Characters Problem
Consecutive Characters Problem — ExecCode Easy DSA Practice
Solve the Consecutive Characters problem on ExecCode. Free online easy DSA practice in String. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Description You are given a string s, return the power of s. Your task is to the power of the string is the maximum length of a non-empty substring that contains only one unique character. Return the required answer exactly as shown in the examples.
Examples
Input {"s": "leetcode"}; Output 2. Input {"s": "abbcccddddeeeeedcba"}; Output 5
Constraints
1 <= s.length <= 500 s consists of only lowercase English letters.
Practice Consecutive Characters free on ExecCode. Browse DSA problems, topic map, and placement guides.