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!@@#$%^****#@@%
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Move all Uppercase char to the end of string
- Move all occurence of letter 'x' from the string s to the end using Recursion
- Minimum move to end operations to make all strings equal
- Minimum number of operations to move all uppercase characters before all lower case characters
- Minimum swaps required to move all vowels occurs after consonants in a given string
- Reverse a string without affecting special characters
- Split numeric, alphabetic and special symbols from a String
- Program to count vowels, consonant, digits and special characters in string.
- Count special palindromes in a String
- Check if a string can be rearranged to form special palindrome
- Calculate Sum of ratio of special characters to length of substrings of the given string
- Check if a string contains uppercase, lowercase, special characters and numeric values
- Check if a string consists only of special characters
- Print all Subsequences of String which Start with Vowel and End with Consonant.
- Move spaces to front of string in single traversal
- Python code to move spaces to front of string in single traversal
- Generate all possible strings such that char at index i is either str1[i] or str2[i]
- Convert string to char array in C++
- Count Uppercase, Lowercase, special character and numeric values
- Sum of special triplets having elements from 3 arrays
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.