Given a string S, remove all the consecutive duplicates in this string using STL in C++
Input: Geeks for geeks Output: Geks for geks Input: aaaaabbbbbb Output: ab
The consecutive duplicates of the string can be removed using unique() function provided in STL.
Below is the implementation of the above approach.
Geksforgeks is best
- Remove duplicates from a string using STL in C++
- Remove duplicates from an unsorted array using STL in C++
- Remove duplicates from a sorted array using STL in C++
- Remove duplicates from an array of small primes
- Character replacement after removing duplicates from a string
- Check if a string has m consecutive 1's or 0's
- Counts of distinct consecutive sub-string of length two using C++ STL
- Remove Trailing Zeros From string in C++
- Remove Duplicate/Repeated words from String
- Sum of minimum difference between consecutive elements of an array
- Check if absolute difference of consecutive nodes is 1 in Linked List
- std::remove, std::remove_if in c++
- Remove comments from a given C/C++ program
- list remove() function in C++ STL
- Remove duplicate elements in an Array using STL in C++
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.