Given a string. Write a program to remove all the occurrences of a character in the string.
Input : s = "geeksforgeeks" c = 'e' Output : s = "gksforgks" Input : s = "geeksforgeeks" c = 'g' Output : s = "eeksforeeks"
The idea is to maintain an index of resultant string.
Time Complexity : O(n) where n is length of input string.
Auxiliary Space : O(1)
- Count occurrences of a character in a repeated string
- Number of permutations of a string in which all the occurrences of a given character occurs together
- Print the string by ignoring alternate occurrences of any character
- Remove a character from a string to make it a palindrome
- Check if all occurrences of a character appear together
- Find a string such that every character is lexicographically greater than its immediate next character
- Replace every character of string by character whose ASCII value is K times more than it
- Check if frequency of character in one string is a factor or multiple of frequency of same character in other string
- Replace every character of a string by a different character
- Replace all occurrences of pi with 3.14 in a given string
- Replace all occurrences of a string with space
- Count occurrences of a word in string
- Count of occurrences of a "1(0+)1" pattern in a string
- Rearrange a binary string as alternate x and y occurrences
- Replace all occurrences of string AB with C without using extra space
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.