pyassistant

Longest Even-Count Substring

Given a string s consisting of lowercase English letters, find the length of the longest substring in which every character that appears does so an even number of times. Return the length of that substring. The substring must be contiguous. Example: s = "abacbc", the longest substring where every character appears an even number of times is "bacb" (characters: b,a,c,b -> a appears once? wait), so adjust example properly.

Example:

Input:
("abacbc")
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.