#K62012. Convert Letter Positions to String

    ID: 31437 Type: Default 1000ms 256MiB

Convert Letter Positions to String

Convert Letter Positions to String

You are given a list of integers that represent positions of letters in the English alphabet. The mapping is defined as \(1 \to A, 2 \to B, \ldots, 26 \to Z\). Your task is to convert the list of integers to a string where each integer \(i\) is replaced by the corresponding uppercase letter. If any integer is not in the range \([1, 26]\), print "invalid input".

For example:

  • Input: 1 2 3 results in Output: ABC.
  • Input: 26 25 24 results in Output: ZYX.
  • Input: 0 2 1 or any number outside the valid range results in Output: invalid input.

inputFormat

The input is provided via standard input (stdin). The first line contains an integer \(n\), which represents the number of elements in the list. The second line contains \(n\) space-separated integers.

If \(n = 0\), the input list is empty and the output should be an empty string.

outputFormat

Output a single line to standard output (stdout). If all numbers are valid (i.e., in the range \([1,26]\)), print the corresponding string formed by mapping each number to its uppercase letter. Otherwise, print "invalid input".

## sample
3
1 2 3
ABC