Remove Trailing Zeros From string in C++
Given a string of digits, remove trailing zeros from it.
Input : 00000123569 Output : 123569 Input : 000012356090 Output : 12356090
1) Count trailing zeros.
2) Use string erase function to remove characters equal to above count.
Below is C++ implementation.
This article is contributed by Prakhar Agrawal. 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.