Using arrays instead of strings now (which allows for arbitrary alphabets).
Fixed typo.