Optimize standardize_data for alphabet size k <= 4.