Description
In ancient Mesopotamia, by the rivers of Tigris and Euphrates, the wise king of Baghdad decided to spare his slaves yet another pyramid made of stone. Instead, he chose to create a pyramid of names, also known as a namemid.
He orders you, his loyal architect/programmer servant, to create a pyramid of his name Unfortunately, the wise king has 999 names and he wants a pyramid for each name. He also likes the undulating landscape of his summer palace by the Red Sea, so he wants each pyramid to be of variable height to his liking.
Fortunately you are from the future, and you intend to save time by writing a computer program that takes in 2 inputs. The first input is a name which is a non-null string not longer than 254 characters. The second input is the height of the pyramid which is a positive integer. The program will then print out the pyramid of names as shown in the sample below. Note that there is an additional space at the end of each line.
If you succeed, you'll be more famous than I M Pei, and the king will ensure that you will be amply rewarded.
Sample Input 1
namemid
12
Sample Output 1
n
a m
e m i
d n a m
e m i d n
a m e m i d
n a m e m i d
n a m e m i d n
a m e m i d n a m
e m i d n a m e m i
d n a m e m i d n a m
e m i d n a m e m i d n