SP23153 EQUIPASS - Equivalent Passwords
Description
Yesterday you arrived at the hotel, and you kept all your valuable stuff in your room's safe. Unfortunately, you forgot the password. But you have a very long list of passwords (each password is at most 5 digits), and you are sure that your password is one of them.
The safe will consider some passwords equivalent. Two passwords A and B are considered equivalent, if they are of the same length, and |A\[i\] - B\[i\]| is the same for all possible values of i, where X\[i\] is the i-th digit of X and |Y| is the absolute value of Y.
You will go through the list of passwords in the given order. For each password, you will do the following:
If the same password or any of its equivalent passwords were typed before, skip this password.
Otherwise, type this password into the safe.
If it's the correct password (or any of its equivalent passwords), the safe will open and you will stop any further processing.
Now given the list of all passwords, you would like to know, in the worst case scenario, what is the maximum number of passwords you will have to type?
`Input Format:`
Input Format
N/A
Output Format
N/A