generate mapping from char to int