Grandma's knits
Totos loves his grandmother very much. He always tries to spend as much time with her as possible, especially during Christmas.
Every year during this time, his grandmother prepares gifts for her children, grandchildren and great-grandchildren, which are none other than hand-knitted items!
Grandma, of course, knows that not everyone has the same tastes nor the same needs.
Some prefer scarves either short or long while others prefer a sweater in a size that fits them.
This year, Toto has decided to help his grandma in the making of the knitting patterns- surely a program that automatically determines the pattern she needs to knit is going to help her a lot!
We want to write a program that will read from the input STDIN
a character , followed by a positive integer , separated by a space character (' '
), and print to the output STDOUT
multitudes of characters 'x'
or spaces ' '
and '\n'
.
- The (
'K'
,'S'
,'M'
,'L'
) denotes the type of the knit. - () denotes the number of designs of the knitted fabric.
- When the knit type is
'K'
scarf, the pattern is repeated in a row. - When the knit type is a sweater of size
'S'
or'M'
or'L'
, the design is repeated horizontally.
Attention! Each input or output line should end with the line change character '\n'
.
Examples
1st
STDIN
Κ 4
STDOUT
x x x x
x x x x
xx xx
x x x x
x x x x
x x x x
x x x x
xx xx
x x x x
x x x x
x x x x
x x x x
xx xx
x x x x
x x x x
x x x x
x x x x
xx xx
x x x x
x x x x
2nd
STDIN
S 3
STDOUT
xx xx xx xx xx xx
xx xx xx xx xx xx
xxxx xxxx xxxx
xx xx xx
xxxx xxxx xxxx
xx xx xx xx xx xx
xx xx xx xx xx xx
xx xx xx xx xx xx
xx xx xx xx xx xx
xxxx xxxx xxxx
xx xx xx
xxxx xxxx xxxx
xx xx xx xx xx xx
xx xx xx xx xx xx
3rd
STDIN
M 1
STDOUT
xxxx xxxx
xxxx xxxx
xxxxxxxx
xxxxxx
xxxxxxxx
xxxx xxxx
xxxx xxxx
xxxx xxxx
xxxx xxxx
xxxxxxxx
xxxxxx
xxxxxxxx
xxxx xxxx
xxxx xxxx
4th
STDIN
L 2
STDOUT
xxxxxx xxxxxx xxxxxx xxxxxx
xxxxxx xxxxxx xxxxxx xxxxxx
xxxxxxxxxxxx xxxxxxxxxxxx
xxxxxxxxxx xxxxxxxxxx
xxxxxxxxxxxx xxxxxxxxxxxx
xxxxxx xxxxxx xxxxxx xxxxxx
xxxxxx xxxxxx xxxxxx xxxxxx
xxxxxx xxxxxx xxxxxx xxxxxx
xxxxxx xxxxxx xxxxxx xxxxxx
xxxxxxxxxxxx xxxxxxxxxxxx
xxxxxxxxxx xxxxxxxxxx
xxxxxxxxxxxx xxxxxxxxxxxx
xxxxxx xxxxxx xxxxxx xxxxxx
xxxxxx xxxxxx xxxxxx xxxxxx
Comments