Hi, everyone.
So in this video, we are going to solve this question, remove character.
So let's take one string as input.
So if this is our string A, B, C, D, A, B, E, F, and then we have none.
So what I want to do so I want to remove character from my string.
So is President Taylor.
So remove a remove a and what is my final string.
B, C, D, bsf.
So given this string I need to return this string, I have to change, I need to modify the given string.
OK, so I need to modify the string and I need to replace all the characters.
A simple so we can solve this question with the help of Folbre I look but since we are learning regression
so we will solve this question with the help of recursion.
So let's see how we can solve this question.
So what I'm planning to do here is so if this is our creperie.
So first of all, let's talk about the biscuits.
So biscuits is very simple.
If I were correct, that is empty.
So if basically input of zero is null.
So if in Berdovsky regional if character is and then we do not need to do anything, we will simply
have done so basically it's very simple.
So now let's discuss about how we can solve this question.
So first of all, I will check for the first element.
I will do the small work.
So let's check for the first element.
So there are two possible cases.
So first cases basically in Port of Zero is equal to the character.
And second case is basically in Port of Zero.
Is not close to correct, Perry.
So if this is a situation gets to link it to is very simple, if it is not present here, let's say
it is B, then you will simply call that equation on the on this area.
So we will simply call the equation and we will give input plus one.
So this is input plus one.
So I'll simply call that equation on this small error and the equation will remove all the occurrence
of that equation, will remove all the occurrences of it.
We do not have to do anything if the situation is Kastel.
Now let's talk about case one, so in case one character is present at the first position.
So if this is a situation abcde, so character is present at the first position.
So what I need to do, what I will do, I will copy all the characters, I will shift all the characters
towards left and we have none here.
So I will shift all the characters towards left.
So it will become B, C, the null.
So we are shifting Nael also and then we have none.
So this will be our new string.
McDannell So if this is a you need to remove a and what is the meaning of removing you will shift all
the characters towards left.
So this will be our new string BCT.
So basically our new string will become B, C, D, and then you do not have to write to in one time
sufficient.
So I was doing this BCT and now we will call that it goes equation on this string.
So we will give input.
This is input and this is not input plus one.
OK, so c originally we had A, B, C and this was input.
So now I am moving all the characters towards left, so my setting will become B, C, the null and
true timetable.
So input is remaining, same input will remain the same.
So we need to call that equation on input only.
We need to call the equation on input and not input plus one.
So let's write the code.
So the name of the function will be void.
We will not return anything, we will do the changes in the string.
Only the name of the function is to remove a ring, to remove the character.
I will take character areas and put.
So the name of the character Ed is in, but the basic it is very simple if my character is empty, so
basically in Port of Zero is null.
In that case, you do not need to do anything you will simply have done, otherwise, you need to check
for the first element.
So if it is present, if he is not present at first and next.
If this is a situation, what we need to do, see if this is our string B, C, D, E, so I am checking
for the first position.
So if it is not there, I will call that on this area and decide in port plus one.
So let's call that equation.
So, Danny, the function is remove me and I will give input plus one.
So what will do?
What I will do so it will remove all the ways.
It will remove all the from this area.
And my final testing will be basically simple.
So the question will do the work correctly now in the ls part if it's present at the first index.
So if it is present, if this is a situation A, B, C and D and we have done so, if it is present
at the first index, then I need to shift all the characters towards left.
So after shifting all the characters towards left, it will be B, C, D, we are shifting B and we
are also shifting then null.
And this is all original, so this remains him.
So this will be my new string.
So this is input and this is also input.
So in the elzbieta, a little.
And that's what we need to move all the characters towards left.
So let's use a follow up.
I will start from index zero and put a.
Is not external.
I placeless what we need to do, we need to write in Batarfi as equals to in Batoff I plus one.
And after doing this, so what will happen, what will the effect of this line?
So this is A, B, C and D, and then we have none.
So I will start from zero.
I am starting from index zero and I is it close to a plus one.
So I equals to eight plus one.
I is equals to a plus one.
I is equals to eight plus one.
I is equals two eight plus one I is equals two plus one.
And then when we will reach the null, when we reach, then we will come out of this loop and that will
remain the same.
So this will be my new string new character three.
And then what we need to do now we need to collocation on this because it is still present, OK, we
need to call that equation.
So input that it will remain same.
This was the input error and this is still input.
That is so we do not but input plus one.
We will simply write input, OK.
So let's call the function, let's call dedication, remove it and I will give input.
So let's test our function, so we are printing our correct.
Now let's call the function, remove a.
I will give the input.
And now let's do two things, let's spend the land, because Lenthall also degrees and let's bring in
prudery also.
So we are sprinting before removing the car today and we are sprinting after removing the character.
So let's see, let's test our function.
So let's say the input is A, B, C, D.
E f, g, h, e, and then again, B and C. So let's see whether our output is correct or not.
So initially the length is 13 and I need to call and function again.
I'm just actually printing.
So let's.
Called the function again.
So we need to call the function and not the variable, so this is lente function and we need to parse
the input.
So the input is received, a, b, c, d, e, f, g, h, e, and let's say the F, the land is basically
17 to 17 and this is the input.
So then is present.
So it's present here is presented.
So we will remove four characters.
So the length becomes thirteen and you can see is not present in this.
So we are updating, we are updating our input area.
So I wouldn't put arrays change because that is our past biodefense.
Let's test one more time.
Let's test it one more time.
So let's say the input is A, B, C, D, E, F, G, and again, A, B.
So initially, the total number of characters is 10 Launceston, so is present two times here, one
time here and one time here.
So Lenthall decreased by four and here.
So he's not President BCT, bct, FGB, FGB.
So basically our function is working properly.
So this is it from this video.
I will see you in the next one.