#K75822. Challenge Code Pattern

    ID: 34505 Type: Default 1000ms 256MiB

Challenge Code Pattern

Challenge Code Pattern

Given an integer (N), generate a letter pattern using the first (N) uppercase letters of the English alphabet. The pattern is built in two phases:

  1. Upward Phase: For the (i)th line (starting from (i=1)), print the (i)th letter repeated ((N-i+1)) times. That is, the first line prints (A) repeated (N) times, the second line prints (B) repeated ((N-1)) times, and so on.

  2. Downward Phase: Repeat the upward phase in reverse order.

For example, for (N=3):

Upward Phase:

AAABBCAAA \\ BB \\ C

Downward Phase:

CBBAAAC \\ BB \\ AAA

Thus, the overall output is:

AAABBCCBBAAAAAA \\ BB \\ C \\ C \\ BB \\ AAA

For multiple test cases, you are to generate and output the corresponding patterns for each test case. For clarity, separate outputs of different test cases by a blank line.

inputFormat

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

  • The first line contains an integer (T) denoting the number of test cases.
  • Each of the following (T) lines contains a single integer (N) representing the size of the pattern.

Input Format: (T) (N_1) (N_2) (\vdots) (N_T)

outputFormat

For each test case, output the generated pattern. The pattern consists of multiple lines, where the first half is the upward phase and the second half is the downward phase. For multiple test cases, separate the outputs with a blank line. The output should be written to standard output (stdout).## sample

1
1
A

A

</p>