Company: Mathworks_31july
Difficulty: medium
Word Compression Problem Description A student decides to perform some operations on big words to compress them, so they become easy to remember. An operation consists of choosing a group of K consecutive equal characters and removing them. The student keeps performing this operation as long as it is possible. Determine the final word after the operation is performed. Examples Example 1: word = "abbcccb" k = 3 Remove k = 3 characters 'c', now word = "abbb". Remove 3 characters 'b', so the final word is "a". It can be easily proven that the final word will be unique. Also, it is guaranteed that the final word consists of at least one character. Function Description Complete the function compressWord in the editor below. compressWord has the following parameter(s): string word: a string of lowercase English letters int k: the number of consecutive equal characters Returns: string : denotes the final word. Constraints 1 ≤ |word| ≤ 10 5 1 ≤ k ≤ |word| Sample Case 0: Input: word