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
- Convert string to char array in C++
- Count special palindromes in a String
- Reverse a string without affecting special characters
- Split numeric, alphabetic and special symbols from a String
- Check if a string can be rearranged to form special palindrome
- 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
- Number of special pairs possible from the given two numbers
- Sudo Placement | Special Subsequences
- Sum of special triplets having elements from 3 arrays
- Count the number of special permutations
- Inverting the Move to Front Transform
- Generate all possible strings such that char at index i is either str1[i] or str2[i]
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 Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.