Marks :100
: 7 | : 6
Bob is painting a wall. The wall contains N Sections and he has already painted some sections of the wall randomly.
The wall consists of a string of length N containing lower-case alphabets 'a' to 'z' denoting the color of the section. in 1 operation. Bob can paint a single section of the wall to any new colour.
He is now tired and does not want to do more than k operations. So, he decides to create a continuous segment of the wall which is completely the same colour (a range [i, j] where all wallſk] are equal, i <= K <= 1) What is the maximum length of such a segment he can Create?
The first line of input contains a string s of size N ($$$1 \le N \le 10^5$$$)
The next line of input contains an integer k ($$$0 \le k \le 10^5 $$$)
For each test case print What is the maximum length of such a segment, he can Create?
abaab 1
4
Example : Wall="abaab" and k=1
Bob can paint the 2nd to 'a' so now the maximum segment he can paint is : 4
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.