This problem is similar to previous example.
Just we have to see that after poping every a's for 'b' there is one 'b' remaining in input.
For every two a's push two a's into STACK cause there are two b's for one 'a'
So by pushing two 'a' we can have 'a' for every 'b'.
That we will achieve by pushing two a's and poping a's for every b
And then pushing c's and poping c's for every d's
So in the end of the strings if nothing is left in the STACK then we can say that language is accepted in the PDA.
But to design PDA we have to change format of the languge as:
Means for first 'b' coming from input we will not do anything.
We have designed the PDA for the problem:
STACK Transiton Function
δ(q0, a, Z) = (q0, aaZ) δ(q0, a, a) = (q0, aaa) δ(q1, b, a) = (q1, a) δ(q0, b, a) = (q1, ε) δ(q1, b, a) = (q1, ε) δ(q1, ε, Z) = (qf, Z)
Note: qf is Final State
ExplnationLets see, how this DPDA is working:
We will take one input string: "aabbbbb"
The explanation might be looking over descriptive but please be patient, It will all get clear once you start to get along with the explanation.
So we suggest you to keep doing the practice with the steps mentioned in the explnation