I have seen this similar question but I can't seem to apply the same technique for the equation $7j = 5i + 6k$
Asked
Active
Viewed 211 times
1 Answers
0
Implement using the stack an accumulator that counts the quantity $$ 5\#_a(w) - 7\#_b(w) + 6\#_c(w), $$ where $w$ is the word read so far, and $\#_\sigma(w)$ is the number of $\sigma$ in $w$. This value can be represented, for example, as the empty stack if the accumulator is zero, as $n$ many $+$s if the value is $n$, and as $m$ many $-$s if the value is $m$.

Yuval Filmus
- 276,994
- 27
- 311
- 503