dp with size 1024 (2^10 for 10 digits) and fill it with a large number (size of the string), except for dp[0] which should be set to -1.res for the result and mask for the current bitmask.mask by toggling the bit corresponding to the current digit.
b. Update the result res with the maximum of the current result and the difference between the current index and the first occurrence of this mask in dp.
c. For each digit from 0 to 9, toggle the corresponding bit in the mask and update the result res if we find a longer awesome substring.
d. Update dp[mask] with the minimum of the current index and the existing value in dp[mask].res.