Solutions This problem can be solved in several ways, each carrying its own pros, cons and tradeoffs. All the solutions are based on this observation: the answer is always $$max(6-n,4-d)$$ where $$n$$ is string length and $$d$$ is the number of different type of characters that are already present in the input password. Preamble We call character family the group of characters belonging to the same requirement. The problem requires to check against 4: digits, lowercase letters, uppercase letters, special chars. [Read More]