Company: Arista_27_Dec
Difficulty: medium
Compress Big Words A student shortens overly long words by stripping out runs of consecutive matching letters. One operation consists of picking a run of k consecutive identical characters and deleting it. The student repeats this operation for as long as it remains possible. Work out what the word looks like once no more such operations can be performed. It is guaranteed that the final word will be unique and will consist of at least one character. Example word = "abbcccb" k = 3 Remove three consecutive 'c' characters: "abbcccb" → "abbb" Remove three consecutive 'b' characters: "abbb" → "a" The final word is "a". Function Description Complete the function compressWord in the editor. It has the following parameter(s): string word : a string of lowercase English letters int k : the number of consecutive equal characters Returns string : the final word Constraints 1 ≤ length of word ≤ 10 5 1 ≤ k ≤ length of word Sample Cases Sample Case 0 Input: word = "aba" k = 2 O