Company: JPMC_1april
Difficulty: medium
You are given: A string s containing only lowercase English letters An integer k, the maximum number of identical characters allowed consecutively From the characters in s, construct a new string by: Rearranging the characters Removing characters if necessary The constructed string must satisfy: No character appears more than k times in a row Among all valid strings, the result is the alphabetically largest (comes last in dictionary order) Return the resulting string. Example Suppose s = "baccc" and there can be no more than k = 2 consecutive matching letters. Output: "ccbca" The alphabetically largest string that can be formed with these letters is "cccba", but there cannot be more than two consecutive matching characters. Constraints 1 ≤ n ≤ 10 5 1 ≤ k ≤ 10 3 The string s contains only lowercase English letters. #include <bits/stdc++.h> /* * Complete the 'getLargestString' function below. * * The function is expected to return a STRING. * The function accepts follow