Hi, everyone.
So in this video, we are going to solve this question, Brent, this subsequence is ousting rather,
I should say, Brent Oil Subsequence says of the strength.
So this is my strength.
ABC, Wattyl Subsequence so and pretesting A, B, C, Ebe, B, C, E, C, ABC.
So we need to print all this.
So we need to print all these eight strings.
So why it.
Because ABC is offline three and due to the power three is eight.
So basically if you have.
A string which is of Lent and then the number of subsequent sets will be true to the power, and so
number of subsequent says will be true to the power end and why this formula is correct, because,
see, every character has option, whether I should include it or I should not include.
So I am not including Rick Perry.
I'm not including Rick Perry.
I am not including Rick Perry.
So every character has a choice, whether it should be included in the subsequence ordered will not
be included.
So this character has to choice.
This character has to choice whether it will be included or it will not be included.
This character has to choice, include and exclude.
And you can multiply this.
So the output is eight.
So that's where you will get your subsequence is OK.
I'm repeating myself.
So if you have a correct pair of land and so if you have a pair of lanterne so each character will have
two choices include or exclude, including the subsequence or exclude again to choice include exclude
two choice and it will go on.
And if you will multiply all of them, you will get this formula.
So total number of subscribers will be true to the power.
And so what is our work?
So we need to print, given the string, given the string ABC, we need to print all these subsequent
sets.
So we need to print everything.
So this is the case and pretesting do not take anything.
So basically exclude every character.
So if you will exclude every character, you will get an pretesting and if we will include every character,
so include all the characters.
You will get this string A.B.C..
OK, so this is include every character, this is exclude every character.
So we need to print all these sequences.
So the approach is very simple, really use recursion to solve this problem.
OK, so let's take this example ABC and let's see how it will work, how recursion will work.
So every character has two options include and exclude so correctly include and exclude.
So if you will exclude.
Then hosting is busy, if you will include the character, then hosting is ABC.
Now let's check for V..
So if you will include if you will exclude the character, you will get to see if you will include the
character, you will get busy.
Similarly, if you will exclude the character, you will get AC.
If you will include the character, you will get ABC.
So on the left, we have, excluding the character, exclude on the left and include on the right and
Golddigger to exclude the character.
OK, so you're done with done.
Now let's check Forese.
So exclude the character.
You will get a pretty string, include the character you will get see.
So exclude the characters.
You will get to include the characters.
You will get busy.
So see.
So exclude the character.
You will get a include.
The character you will get is so exclude the character ebe include the character A.B.C..
So now you're done excluding you'd be excluding C exclude include and this is the all the eight subsequence.
So we have all heard Subsequence is OK and pristine B C if the ABC and ABC.
So what is it to do so given the input today?
OK, so what I will do.
This is our idea.
This is the input pottery.
So I will work on the small problem, I will work on this problem.
So this character has to choice.
So let's take outputted.
So this character has two choices included exclude.
So I will include this character in the output and I will exclude this character from the output.
And then I will call that equation for the rest of the very simple.
So in order to write the code, so writing the code is very simple.
First of all, string input from the user.
String input.
The scene in port.
And let's take string output, which restored our output, so initially the output is empty, no subsequence
right now and let's call the function Brent Subsequence is.
So Prince Subsequence will take input string and the output string.
Verden Taipei's void Donio, the function is Sprent.
Subsequence.
I will take the input string and I will take.
They are protesting.
So what is our approach?
So first, let us write the best case, so what is the best case?
This case is basically if the string is empty, so Steinkamp means the length will be zero.
So if in baudot length is zero, then virtually my subsequence so I can print the output.
So let's bring to the output.
And we will return, so we will return.
OK, so if the input is empty, I was just print the output and we will return.
So if this thing is empty, see, for biscuits is basically if the string is empty.
So if the input string is empty.
If the input string is empty, then virtually subsequence off and pretesting, so subsequence of everything
will be empty.
So I'm printing output and output is empty.
So this is the best case.
And now what you have to do.
So for every character, we have choices.
First choices basically exclude the character.
So if this is a very, very.
I am talking about the first character, so I am talking about the first character, so exclude this
character means this Eddie.
So pass this, Eddie and what is this, Eddie?
So since we are taking input, so we have.
So since we are using string so we have a function, Sebastiani and I will give one.
So we will use the function Sebesta and I will give one.
So starting from one, give all the string.
So I am passing this.
Now the second option is basically for every character.
The second option is basically include in output.
So this is exclude from output.
Do not consider it and include in output.
And I have this output string, so what I will do, I will include this in output, so I will do output,
not pushback, or I can write output plus input of zettl.
So I can write output plus in output, sitting is empty and we will get this corrected, so I will air
this character.
Inside the input string, I will add this character, so I will add this character and what I need to
do, I need to call that equation for this area and this area.
This small area is in Baudot Sebastian.
I'm using the function SWG are a function of substring function of string and I will give one simple.
So I need to make Tuticorin call so every character has two choices.
So the first choice is.
What is the first choice?
First choice is basically exclude so put subsidiaries in both function, I will give one.
So do not consider.
So does this exclude a choice and now we will write the court for include so include this character,
so important subsidiary.
Your next one, and I need to include it in my output, so output plus input of zero.
And I think our function will work.
So what I'm doing.
Basically is very simple, and I told you, every character has to choice, every character has two
traits include and exclude.
So let's talk about the first character.
So first character has to choice, include and exclude.
So this is the case for exclude.
So exclude means.
This area, but this area, so this is in Darwin, so I'm passing this area.
OK, I am passing this idea to the recursion, so I decided to go recursion.
And the second choice is basically ignore this correctly in your output, include this character in
your output.
So this is our output string.
So I will include this character in my output string.
So after including this character, after including this character, Galán decided to call Undercity.
We are calling on the IRA.
And finally, again, exclude, include, exclude and include, and it will go on.
So let's see, let's give an input and let's see whether our output is right or wrong, whether our
function is right or wrong.
So this is in Portland.
So let's give the string, ABC, ABC, and these are all subsequence, so let's test whether our subsequence
is right or wrong and let's also check the order order in which the subsequence are getting printed.
So, see, I have this string, ABC, ABC, so I'm standing at correctly so Carter has to choice, exclude
and include.
So exclude the character B, C, include the character ABC.
Now, let's talk about second character.
Again, it has to include and exclude.
So if you will include sorry, Frosties exclude, you will get a C and if you will include you will
get busy.
Similarly, if you will exclude, you will get SC.
If you will include you will get ABC.
So now let's talk about characters.
So exclude the character and pretesting include the character.
C exclude the character.
B include the character B C exclude the character.
A include the character is he so exclude the character ebe include the character A.B.C. so allergic
and pretty string C.
So first this is an pretesting and the cesi, then we have B is BSI, then we have Effi.
So this is Athie and then we have A B ABC, then we have a B on ABC.
So basically first I am excluding the character on the left and the right, I am including the character.
So basically you can see this order and this order.
They are exactly the same.
OK, so what I'm doing here is if you want to change the order.
So first I'm excluding if you want to change the order, you can just print this line above.
Then the order of printing will be changed.
So order of printing will be changed.
So let's see.
So if I will give the input.
So if I were to give the input A.B.C., the output of printing, the order of printing will be changed.
So let's see what is the order now?
So right now, what I'm doing so first I am including, then excluding.
So first include and then exclude.
So the order of printing will be different.
So the string is ABC.
Let's talk about character.
So first include and then excluded.
So include ABC.
Exclude ABC.
Let's talk about character B included.
So ABC exclude esy so include ABC exclude C let's talk about characters include ABC excluding ABC include
issie exclude a show include ABC exclude c include c exclude and producing.
So now you can see the output is ABC, ABC, ABC, ABC, then ABC.
So ABC and then we see.
OK, so what happened there is.
OK, so this is wrong.
Should we be left is include right, is exclude so often excluding this will be so this is B.S. and
pretty busy.
And so this is embarrassing.
So our function is working properly, so if you are having difficulty in understanding the question,
using what you can do, you can write the exact same function with the help of Coté also.
So let's modify this function and let's use capillary.
But look at that, what do you need to so Brent Subsequence is to I will take Beretti.
So let's take that out to Terry.
And to push values inside the character, I would put areas where I cannot use plus operator with the
output, that is what I need to do.
I need to take one index for feeling the value, for feeling the output area.
So let's take the index I, I will fill the output area so I cannot use this function.
So you need to check and particularly so if input of zero is basically nil.
So this will be null.
Then basically testing is empty, so you cannot print, we can be interesting, but for printing the
output first you need to put the nail character and then you will print.
So put the character at the next site.
So we are putting the character at the next site and then we can return the call this function, we
cannot pass like this, so we will write in particular one.
And similarly, we will write in particular one.
So this is the case for including so we cannot include we can include like this output of Nixey is basically.
And pataphysical, so I'm including if I'm including, I will pass the output today and I will pass
I plus one and here I am not including so I will pass.
I see I is the index which I'm using to fill this out prudery.
So this is a condition for including and this is a condition for not including and let's call the function.
So let's name it character in body.
After taking the input, so this is the correct output, Terry.
So let's say the output error is of size, then I'm calling the function and I need to pass the index
next to zero, so let's call this function Brint subsequent to this is subsequence to the subsequent
stool, and I will call the function Brent Subsequence to.
So I need to give the size sizes and.
So the input is ABC and this is the output.
OK, so this is the number of subsequence, all the subsequent are getting printed.
So the working is exactly the same.
The working of this function, the working of this, the working of this function and this function
is exactly the same.
So the only differences here I am taking stock and here I am taking 30.
So that's why you need to take one variable so that you can fill the output data.
You cannot you you can do plus operator with strings you cannot use plus operator with.
Correct.
And that's why you need to take one variable to fill the output of the output error and to move forward.
OK, you can also change the order.
So if you will change the order, the order of printing will also be changed.
OK, so let's change the order.
So let's change the order first, I will exclude control X.
So first I'm excluding and then I'm including, so let me read the comment here.
So this is the code for including.
And this is the code for excluding.
And so this is first time including.
And then I'm excluding the character.
So let's call both the functions, so I will call the function.
Brent Subsequence to Ben Subsequence, I will give the input today, so I will give the input that I
will give the output little change that emphasis, input and output in and out.
And let's take Stringer's input.
So string input.
So this is in an instant, but.
And let's create outputting.
Initially, they are protesting is basically empty.
Let's make it a hundred and let's make it 10.
Let's give our online.
See what is happening here, what I'm doing, so I'm calling this function and I am also calling this
function, so I'm taking input two times.
So first time and second time, I will give the same input.
I will give input ABC hit and I will give the input ABC.
So in this function, what I'm doing so first I'm including the character, then I'm excluding the character.
And in this function, first time excluding the character, then I'm including the character.
So what should happen?
It's the order.
The order of printing will be reversed.
OK, so there are, there will be reviews of each other or there will be a reversal of each other.
So let's see.
So if the input is basically ABC, ABC, and then you don't think of ABC again.
OK, so for this and this.
So this is the output, so this is the input.
This is the order of printing for.
This is the order for order of printing for this one print subsequence.
So first, I am including first time including and then I'm excluding, and this is the order of printing
for this one.
So first I'm excluding here and then I'm including you can see the orders reversed.
So it starts from ABC.
So it is at last, then ABC, so ABC, then ABC, so ABC, then B, C, ABC.
So M protesting is at last and pretesting is printed at first.
OK, so include exclude order and exclude include order.
The working of dysfunction is exactly the same.
OK, so the working of dysfunction and dysfunction is exactly the same.
So this is it from this video.
I will see you in the next one.
Thank you.