I am curious if there is a reason you're using a table instead of a sequence? I guess you're using the table identically except you have it unorded/hashing to access.
If you used a `seq[char]` you could use `mem[^1]` to get the last element in the sequence.