继续我的那只是一个错误挑战:
输入:
一个字符串,由可打印的ASCII字符组成,没有空格和换行符。
输出:
首先,通过还原输入并将其添加到自身之前,将输入转换为回文,不包括中间字符(即使用输入1234567890
,它将变为0987654321234567890
))。
然后输出此文本:
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0987654321234567890
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
(从两个方向的中间向外,每个字符比上一行多隔开一个空格。)
挑战规则:
- 您需要打印输入长度的两倍,减去3行。所以用输入
1234567890
,上面显示的输出为17行(长度为10 * 2-3)。 - 输入将仅包含可打印的ASCII(不包括空格,制表符和换行符)。
- 尾随空格是可选的。
- 一条尾随的换行符是可选的。
- (不允许)前导空格或前导换行符。
- 您可以假设输入将始终至少包含四个字符。
- 与我不同的是,这只是一个错误挑战,输入和输出格式都很灵活。因此,您可以将结果输出为字符串数组,字符串列表等。
通用规则:
- 这是代码高尔夫球,因此最短答案以字节为单位。
不要让代码高尔夫球语言阻止您发布使用非代码高尔夫球语言的答案。尝试针对“任何”编程语言提出尽可能短的答案。 - 标准规则适用于您的答案,因此您可以使用STDIN / STDOUT,具有正确参数的函数/方法和返回类型的完整程序。你的来电。
- 默认漏洞是禁止的。
- 如果可能的话,请添加一个带有测试代码的链接。
- 另外,如有必要,请添加说明。
测试用例:
Input: 1234567890
Output:
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0987654321234567890
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
Input: ABCD
Output:
D C B A B C D
D C B A B C D
DCBABCD
D C B A B C D
D C B A B C D
Input: =>)}]
Output:
] } ) > = > ) } ]
] } ) > = > ) } ]
] } ) > = > ) } ]
]})>=>)}]
] } ) > = > ) } ]
] } ) > = > ) } ]
] } ) > = > ) } ]
Input: XXxxXX
Output:
X X x x X X X x x X X
X X x x X X X x x X X
X X x x X X X x x X X
X X x x X X X x x X X
XXxxXXXxxXX
X X x x X X X x x X X
X X x x X X X x x X X
X X x x X X X x x X X
X X x x X X X x x X X