Optimization for 1 and 2-digit cases in undigits().