Assign small index to frequent characters.