Solution to removing spaces from a string is already posted here. In this article another solution using stringstream is discussed.
1. Enter the whole string into stringstream. 2. Empty the string. 3. Extract word by word and concatenate to the string.
Thisisatest geeksforgeeks geeksquizisawsome! Ilovetocode
This article is contributed by Nishant. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Sentence Palindrome (Palindrome after removing spaces, dots, .. etc)
- String containing first letter of every word in a given string with spaces
- Remove spaces from a given string
- C++ Program to remove spaces from a string
- Remove extra spaces from a string
- URLify a given string (Replace spaces is %20)
- How to remove all white spaces from a String in Java?
- Move spaces to front of string in single traversal
- Python code to move spaces to front of string in single traversal
- stringstream in C++ and its applications
- Removing punctuations from a given string
- StringStream in C++ for Decimal to Hexadecimal and back
- Find words which are greater than given length k using stringstream
- Modify string by removing vowels in between two consonants
- Balance a string after removing extra brackets