I am able to remove the consecutive elements(all character of the element that is consecutive even for one time) if present but don’t know how to approach after that.
How to sovle the following problen using string STL?
Okay I’ll share my approach.
Run 2 for loops selecting all combination of characters.
Now let’s say first character is ‘i’ and second character is ‘j’.
Now traverse the string ,by keeping a variable flag. flag needs to be used to check whether this combination of letters is valid or not. Lets say flag = 1, if the character seen was i, now if again an i is seen and flag is still 1 then the combination of letters is not valid, but if we see j before an i make the flag 0, and then continue till the end by alternating the values of flag at every instance.
Try to implement this logic and if it doesn’t work I’ll share the code.