In this article, we will learn how to move all special char to the end of the String.
Input : !@$%^&*AJAY
Input :Geeksf!@orgeek@s A#$ c%o^mputer s****cience p#o@rtal fo@r ge%eks
Output :Geeksforgeeks A computer science portal for geeks!@@#$%^****#@@%
Prerequisite : Regular Expressions in Java
The idea is to traverse input string and maintain two strings, one string that contains normal characters (a, A, 1, ‘ ‘, etc) and other string that maintains special characters (@, $, etc). Finally, concatenate the two strings and return.
Here is the implementation of above approach
Geeksforgeeks A computer science portal for geeks!@@#$%^****#@@%
- Move all Uppercase char to the end of string
- Count special palindromes in a String
- Reverse a string without affecting special characters
- Check if a string can be rearranged to form special palindrome
- Split numeric, alphabetic and special symbols from a String
- Move spaces to front of string in single traversal
- Program to count vowels, consonant, digits and special characters in string.
- Python code to move spaces to front of string in single traversal
- Convert string to char array in C++
- Sudo Placement | Special Subsequences
- __file__ (A Special variable) in Python
- Count the number of special permutations
- Sum of special triplets having elements from 3 arrays
- Number of special pairs possible from the given two numbers
- Inverting the Move to Front Transform
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.