I am trying to create a DPDA that accepts words from the following Language:
$$ L = \{wx \; | \;w \in \{a,b\}^*, \#a = \#b \} $$
My intuition was to initially put an $x$ on the stack and then write an unlimited amount of $a$ or $b$, while both operations put an $B$ or $A$ on the stack. Then, in the second last state we can write an limited amount of $a$ and $b$ for popping an $A$ or $B$ from the stack.This ensures that the amount of $a$ and $b$ are equal before we can read the initial $x$ from the stack. As a last step, we read $x$ as the last element of the stack. However, building this determinstic seems too complex. Any hints?