#K94872. Deterministic Password Generator

    ID: 38738 Type: Default 1000ms 256MiB

Deterministic Password Generator

Deterministic Password Generator

You are given an integer N representing the desired length of a password. Your task is to generate a deterministic password of length N that satisfies the following conditions:

  • The password must contain at least one lowercase letter.
  • The password must contain at least one uppercase letter.
  • The password must contain at least one digit.

To make the output deterministic for the same input, use the following algorithm:

  1. Let the first character be chr((N % 26) + 97) (a lowercase letter).
  2. Let the second character be chr(((N+1) % 26) + 65) (an uppercase letter).
  3. Let the third character be str((N+2) % 10) (a digit).
  4. For every index i from 3 to N-1 (0-indexed), append a character chosen as follows:
    • If i is even, choose chr(((N+i) % 26) + 97) (lowercase letter).
    • If i is odd, choose chr(((N+i) % 26) + 65) (uppercase letter).
  5. Reverse the entire sequence of characters and output the result.

If the input N is not in the range \(3 \le N \le 100\), then output ERROR.

Note: This algorithm ensures that the same input always produces the same password.

inputFormat

The input consists of a single integer N (\(3 \le N \le 100\)).

outputFormat

Output a single string which is the generated password if N is valid, or output ERROR if N is outside the allowed range.

## sample
3
5Ed