pyassistant

Longest run of consecutive equal characters

Given a string s, find the length of the longest run of consecutive identical characters. The run length of an empty string is 0. For example, in "aaabbcaaaa" the longest run is 4 (for the four 'a' at the end). Return the length as an integer.

Example:

Input:
('aaabbcaaaa',)
Output:
4

Make sure you return your solution, don't print!

AI

Bot

Trying to solve my challenge? Ask if you must, or press the purple button so I can analyze your code.