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
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Remove duplicates from a string using STL in C++
- Remove duplicates from a sorted array using STL in C++
- Remove duplicates from an unsorted array using STL in C++
- Counts of distinct consecutive sub-string of length two using C++ STL
- Remove duplicates from an array of small primes
- Remove duplicate elements in an Array using STL in C++
- Character replacement after removing duplicates from a string
- list::remove() and list::remove_if() in C++ STL
- forward_list::remove() and forward_list::remove_if() in C++ STL
- list remove() function in C++ STL
- Given a sequence of words, print all anagrams together using STL
- Print Minimum of all Subarrays using set in C++ STL
- All permutations of an array using STL in C++
- All reverse permutations of an array using STL in C++
- Permutations of a given string using STL
- Conversion of whole String to uppercase or lowercase using STL in C++
- Find and print duplicate words in std::vector<string> using STL functions
- Lexicographic rank of a string using STL
- Count number of unique Triangles using STL | Set 1 (Using set)
- Color all boxes in line such that every M consecutive boxes are unique
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.