#C8463. Secure Password Completion

    ID: 52448 Type: Default 1000ms 256MiB

Secure Password Completion

Secure Password Completion

You are given a list of passwords. Your task is to determine the minimum number of characters that must be added to each password in order to make it secure.

A password is considered secure if it satisfies all of the following criteria:

  • It contains at least one uppercase letter.
  • It contains at least one lowercase letter.
  • It contains at least one digit.
  • It contains at least one special character from the set \(\{!@#$%^&*()-+\}\).

For each password, output the minimum number of characters needed to be added to meet all of these conditions.

inputFormat

The input is read from standard input (stdin) and has the following format:

T
password_1
password_2
... 
password_T

Where T is an integer representing the number of test cases, and each following line is a password string.

outputFormat

For each test case, print a single integer on a new line, representing the minimum number of characters that must be added to make the password secure.

## sample
4
password
password123
Pass123
Pass123!
3

2 1 0

</p>