#C3495. Right-Aligned Alphabet Triangle Patterns
Right-Aligned Alphabet Triangle Patterns
Right-Aligned Alphabet Triangle Patterns
In this problem, you are given a number of datasets. For each dataset, an integer (n) is provided which represents the height of an alphabet triangle pattern. For each dataset, you are required to print a triangle where the (i^{th}) line consists of the first (i) uppercase English letters (starting from 'A') right aligned within a width of (n) characters. Different datasets are separated by an empty line.
For example, if (n = 5), the triangle should look like:
A AB ABC ABCD ABCDE
Use standard input (stdin) to read the number of datasets and the corresponding heights, and print the output to standard output (stdout).
inputFormat
The first line contains an integer \(d\) (\(1 \le d \le 100\)) indicating the number of datasets. Each of the following \(d\) lines contains a single integer \(n\) (\(1 \le n \le 26\)) representing the height of the triangle for that dataset.
Input Format:
d n1 n2 ... nd
outputFormat
For each dataset, output an alphabet triangle pattern consisting of \(n\) lines. In the \(i^{th}\) line, print the first \(i\) letters from the alphabet right aligned within a field of width \(n\). Output patterns of multiple datasets must be separated by an empty line.
Output Format:
[Pattern for Dataset1]## sample</p>[Pattern for Dataset2]
...
[Pattern for Datasetd]
2
5
4
A
AB
ABC
ABCD
ABCDE
A
AB
ABC
ABCD
</p>