I'm stuck building the transition functions for this automaton.
I suppose I should stack a 1 for each a and unstack it for each b
The number of c's equals the number of ab pairs, so I think I should stack a 0 for each b I encounter. Thing is: how do I unstack 1s and add 0s at the same time?
Don't push a
0
onto the stack each time you encounter ab
. Instead, push a0
onto the stack each time you encounter ab
and the stack is empty or the top of the stack is a0
.So, using your nomenclature for
aabbabcc
:Stack is empty so we accept this string.