To work with strings, you must be familiar with the string its method, and how it works, also you need a sound knowledge of the list as well, but in case if you don’t know, then you just need to know the basics of programming and you are good to go.
First and foremost, let us see the actual algorithm that is how will approach the problem. And this way of approaching problems is quite essential, simply put you divide the problems into smaller chunks and then you conquer it.
- We will take a string
- We will ask the user to input his/her desired character
- Take new empty string
- Iterate through old_string
- If char is in old_string
- Do not include it in new_string
- Else include it in new_string
- print the new_string
- We have taken a string
- We have taken a variable called char to take input from the user
- We have taken a new_string for storing the output
- We have iterated through the string and each character of string comes in I in each iteration
- We have checked if I value is equal to input char from the user
- If it is equal then we have inserted an empty space into new_string.
- If it is not equal then we have inserted the char as it is in new_string.
- Finally, we have printed the output