#K34292. Minimum Additional Characters for a Valid Password

    ID: 25277 Type: Default 1000ms 256MiB

Minimum Additional Characters for a Valid Password

Minimum Additional Characters for a Valid Password

The company has a strict password policy: every password must contain at least one uppercase letter, one lowercase letter, one digit, and one special character. The allowed special characters are given by the set \( \{!@#\$%\^&*()\} \). Given an input string (which represents the current password), determine the minimum number of additional characters required so that the password meets all the criteria.

Note: The answer is simply the count of how many of the required character types are missing from the password.

For example:

  • Input: "Passw1" has uppercase, lowercase, and digit but is missing a special character so the answer is 1.
  • Input: "Secure!" has uppercase, lowercase, and special character but is missing a digit so the answer is 1.
  • Input: "123" only has digits, so it is missing uppercase, lowercase, and special characters resulting in an answer of 3.

inputFormat

The input is provided via standard input (stdin) and consists of a single line containing the password string.

outputFormat

The output should be printed to standard output (stdout). It is a single integer representing the minimum number of additional characters that must be added to make the password valid.

## sample
Passw1
1