the solution is really not trivial. I don't think I can finish it easily
Can we solve this problem using edit distance.
I mean, we construct a qualify password using some kind of search and then calculate the edit distance,
then we choose the minimum edit distance.
This is just my guess.