We've had a lot of alphabet challenges. For this challenge, you are passed the output of an alphabet challenge, and you need to output the pattern scaled to size N
.
For example, if N=5
and you were passed the L-phabetL-phabet:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
BBCDEFGHIJKLMNOPQRSTUVWXYZ
CCCDEFGHIJKLMNOPQRSTUVWXYZ
DDDDEFGHIJKLMNOPQRSTUVWXYZ
EEEEEFGHIJKLMNOPQRSTUVWXYZ
FFFFFFGHIJKLMNOPQRSTUVWXYZ
GGGGGGGHIJKLMNOPQRSTUVWXYZ
HHHHHHHHIJKLMNOPQRSTUVWXYZ
IIIIIIIIIJKLMNOPQRSTUVWXYZ
JJJJJJJJJJKLMNOPQRSTUVWXYZ
KKKKKKKKKKKLMNOPQRSTUVWXYZ
LLLLLLLLLLLLMNOPQRSTUVWXYZ
MMMMMMMMMMMMMNOPQRSTUVWXYZ
NNNNNNNNNNNNNNOPQRSTUVWXYZ
OOOOOOOOOOOOOOOPQRSTUVWXYZ
PPPPPPPPPPPPPPPPQRSTUVWXYZ
QQQQQQQQQQQQQQQQQRSTUVWXYZ
RRRRRRRRRRRRRRRRRRSTUVWXYZ
SSSSSSSSSSSSSSSSSSSTUVWXYZ
TTTTTTTTTTTTTTTTTTTTUVWXYZ
UUUUUUUUUUUUUUUUUUUUUVWXYZ
VVVVVVVVVVVVVVVVVVVVVVWXYZ
WWWWWWWWWWWWWWWWWWWWWWWXYZ
XXXXXXXXXXXXXXXXXXXXXXXXYZ
YYYYYYYYYYYYYYYYYYYYYYYYYZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZ
You would need to output:
ABCDE
BBCDE
CCCDE
DDDDE
EEEEE
For the purposes of explanation, I'll be using only ABCD
, instead of the full alphabet. You need to be able to match the L-phabet (above), as well as the following patterns:
The single line:
ABCD or A
B
C
D
The single line repeated N
times
ABCD or AAAA
ABCD BBBB
ABCD CCCC
ABCD DDDD
ABCD
BCDA
CDAB
DABC
This alphabet triangle:
A or AAAAAAA
AB BBBBB
ABC CCC
ABCD D
ABC
AB
A
We also have half triangles in lots of varieties:
A AAAA A ABCD
BB BBB AB ABC
CCC CC ABC AB
DDDD D ABCD A
Finally, the square:
AAAAAAA
ABBBBBA
ABCCCBA
ABCDCBA
ABCCCBA
ABBBBBA
AAAAAAA
All of the above patterns are of size 4. However, you will be passed a pattern of size 26, as well as an N
between 1 and 26, and you need to scale the pattern. You do not need to handle any other patterns.
- The output for 1 will always be the single character
A
- The output for 26 will always be the same, full-sized pattern passed in.
- Trailing spaces are allowed at the end of each line, as well as a trailing newline at the end
- You can find all patterns of size 26 here
This is a code-golf, so do it in as few bytes as possible!