The complexity of a string is the number of distinct letters in it. For example, string has complexity 6 and letter has complexity 4.
You like strings whose complexity is 1 or 2. A friend handed you a string and you want to turn it into a string you like. You have a magic eraser that deletes one letter from the string. Compute the minimum number of times you have to use the eraser to make the complexity of the string at most 2.