NewThe Learning module is now liveSee what's new

(This question is a variation of the LeetCode question 424. Longest Repeating Character Replacement . If you haven't completed that question yet, it is recommended to solve it first.)

A game renders shaders using two GPUs: GPU a and GPU b.

You are given a string s where:

  • s[i] = 'a' → the ithi^{th} shader uses GPU a
  • s[i] = 'b' → the ithi^{th} shader uses GPU b

The idleness of the system is defined as the maximum number of consecutive shaders that use the same GPU.

Test Cases
Input
Output
Expected