您的任务是接受两个“ ASCII Art”作为输入,并水平对齐每个艺术品。
例如,假设您有两个字符串,"abc\ndef"
并且"123\n456"
。您需要将它们水平对齐以产生字符串"abc123\ndef456
“。我称其为“水平对齐”,因为在打印时输入看起来像这样:
abc
def
和:
123
456
打印后的输出将如下所示:
abc123
def456
请注意如何将一个输入放置在另一个输入的旁边。
输入值
- 输入将是字符串,并且可以作为两个单独的参数或字符串序列。
- 艺术人物的十进制代码范围为32-126(含)。
- 可以支持任意数量的艺术来对齐,而不是仅支持两种(但是显然您必须支持至少两种)。
- 您可以假设每种艺术品的尺寸都相同,并且至少包含一行。
您必须至少能够支持100x100的角色艺术。
为了与站点上的约定保持一致,参数顺序无关紧要。左边或右边是哪种艺术都没有关系。
输出量
输出将是如上所述的对齐艺术,返回或输出到标准输出。
可选的任何结尾空格。
对齐的艺术之间不得有视觉分隔符。
输入和输出艺术必须是\n
或\r
字符串分隔。允许2D阵列将太琐碎。
提交的内容可能是功能或完整程序。
测试用例:
"abc\ndef", "123\n456" -> "abc123\ndef456".
"qwertyuiop\n asdfghjkl", "Some other\nTextFiller" -> "qwertyuiopSome other\n asdfghjklTextFiller"
" * \n *** \n*****\n *** \n * \n", " + \n + \n+++++\n + \n + \n" -> " * + \n *** + \n*****+++++\n *** + \n * + \n"
\r
代替使用\n
吗?
"|"
或" "
?