Given a string S delete the characters which are appearing more than once consecutively.
Input: S = aabb Output: ab Explanation: 'a' at 2nd position is appearing 2nd time consecutively. Similiar explanation for b at 4th position.
Input: S = aabaa Output: aba Explanation: 'a' at 2nd position is appearing 2nd time consecutively. 'a' at fifth position is appearing 2nd time consecutively.
You dont need to read input or print anything. Complete the function removeConsecutiveCharacter() which accepts a string as input parameter and returns modified string.
Expected Time Complexity: O(|S|).
Expected Auxiliary Space: O(|S|).
All characters are lowercase alphabets.
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?Yes