Given a string S, remove duplicates in this string using STL in C++
Input: Geeks for geeks Output: Gefgkors Input: aaaaabbbbbb Output: ab
The consecutive duplicates of the string can be removed using the unique() function provided in STL.
Below is the implementation of the above approach.
Rated as one of the most sought after skills in the industry, own the basics of coding with our C++ STL Course and master the very concepts by intense problem-solving.
- Remove all consecutive 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++
- Remove duplicates from an array of small primes
- Remove duplicate elements in an Array using STL in C++
- 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
- Permutations of a given string using STL
- Counts of distinct consecutive sub-string of length two using C++ 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)
- Remove Trailing Zeros From string in C++
- Remove odd frequency characters from the string
- Kruskal's Minimum Spanning Tree using STL in C++
- Dijkstra’s shortest path algorithm using set in STL
- Dijkstra's Shortest Path Algorithm using priority_queue of STL
- Prim's algorithm using priority_queue in STL
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.