#K68502. Letter Pattern

    ID: 32878 Type: Default 1000ms 256MiB

Letter Pattern

Letter Pattern

Given an integer n, generate a letter pattern based on the first n letters of the English alphabet in uppercase. For each i (1 ≤ i ≤ n), the i-th line should contain the first i letters starting from 'A'.

If n is less than 1 or greater than 26, the output should be an empty string.

The pattern for the i-th line can be expressed as:

$$ \text{Line}_i = \bigoplus_{j=0}^{i-1} \text{chr}(65+j) $$

For example, when n = 3, the pattern is:

A
AB
ABC

inputFormat

A single integer n provided on one line.

outputFormat

The letter pattern corresponding to the first n lines. Each line i (1-indexed) contains the initial i uppercase letters of the English alphabet. If n is out of the range [1,26], output an empty string.## sample

1
A