Back to Browse

Java String Manipulation: Removing Consecutive Characters | GFG Practice Solution

932 views
May 24, 2022
15:17

Given a string S delete the characters which are appearing more than once consecutively. Example 1: Input: S = aabb Output: ab Explanation: 'a' at 2nd position is appearing 2nd time consecutively. Similar explanation for b at 4th position. Example 2: Input: S = aabaa Output: aba Explanation: 'a' at 2nd position is appearing 2nd time consecutively. 'a' at fifth position is appearing 2nd time consecutively. Your Task: You dont need to read input or print anything. Complete the function removeConsecutiveCharacter() which accepts a string as input parameter and returns modified string.

Download

0 formats

No download links available.

Java String Manipulation: Removing Consecutive Characters | GFG Practice Solution | NatokHD