Longest Substring Without 3 Contiguous Occurrences of Letter - Company-specific OAs / Microsoft OA

https://algo.monster/problems/longest_substring_without_3_contiguous_occurrences_letter

How is the example “aabbaabbaabbaa” valid? Doesn’t it contain contiguous appearances of “a” and “b” three times? “a” and “b” are appearing contiguously at locations (1, 2), (5, 6) and (9, 10)

read question once again it shouldn’t be more than two contiguous occurrences of a and b

For “aabbaaaaabb” - isn’t output supposed to be “aabbaabb” ?

Wrong question. nvm

The question and solution doesn’t look perfect.
Please check the conditions and answers,

Example 1:

Input: aabbaaaaabb

Output: aabbaa

aabbaaaaa looks like a better answer

Example 2:

Input: aabbaabbaabbaaa

Output: aabbaabbaabbaa

the answer seems wrong.