Marks :100
: 4 | : 0
Given a string S containing only character a and b . A substring (contiguous fragment) of s is called semi-alternating substring if it doest not contains three identical consecutive characters. In other words, It does not contain either 'aaa' or 'bbb' substring .
Note that te wholse S is its own substring
First line of test case contains a string S ($$$1\le S \le 10^5$$$)
For each output print the longest semi-alternating substring
abaaaa
4
babba
5
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.