Artsy Lulu

3.8

16 votes
Easy
Problem

Problem Description

Lulu says

"I love triangles. I love the alphabet, too. Today, I am feeling artsy and I want to mix up these two. Write me a program that draws left-aligned triangles using consecutive letters of the alphabet."

Input Format

Each line of input consists of an alphabetic character ch, either in uppercase or lowercase, and an integer h indicating the height of the triangle. The two values are separated by a single space.

If drawing the triangle with height h using consecutive characters from ch results to portions of the triangle containing non-alphabetic characters, input is also invalid. Height h should be at least 2.

Output Format

For each input, output the corresponding triangle. For invalid input, display "INVALID". Separate output for each test case with an empty line.

Constraints

ch = [a-z A-Z]

2h26

Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?