#C11561. Book Shelf Pattern Arrangement
Book Shelf Pattern Arrangement
Book Shelf Pattern Arrangement
You are given a number of test cases. In each test case, you will receive an integer N representing the number of shelves in a bookcase. For each shelf i (where 1 ≤ i ≤ N), you need to print a row of books represented by the first i capital letters of the English alphabet. In other words, for the first row print "A", for the second row print "AB", for the third row print "ABC", and so on.
You can mathematically define the i-th letter using the formula: $$\text{Letter}_i = \text{chr}(64+i)$$ for \( i \ge 1 \). Your task is to generate and output the complete pattern for each test case.
Example: For N = 3, the output should be:
A AB ABC
inputFormat
The input is read from standard input (stdin). The first line contains a single integer T, the number of test cases. Each of the following T lines contains one integer N (1 ≤ N ≤ 26) representing the number of shelves for that test case.
Example:
3 2 3 4
outputFormat
For each test case, output the pattern of books, where the i-th line contains the first i uppercase letters of the English alphabet. Print an empty line after the output of each test case except the last one.
Example output for the sample input above:
A AB## sample</p>A AB ABC
A AB ABC ABCD
1
2
A
AB
</p>