您将得到一个由可打印ASCII组成的字符串(没有换行符)。您的任务是为我的城堡建造一个漂亮的楼梯。
如何建立一个漂亮的楼梯?
首先,您应该获得String的所有旋转。例如,字符串
abcd
具有以下旋转角度:(abcd, bcda, cdab, dabc
每个字符都移到末尾,直到到达最后一个字符为止)。现在,我们将每个旋转彼此叠加:
abcd bcda cdab dabc
我们不能真正爬上直墙,所以我们必须建造楼梯。这意味着您应该在每次旋转之前在旋转列表中为其索引添加一些空格:
abcd bcda cdab dabc
您还需要连接到我城堡另一侧的楼梯,因此您应该像下面这样建造楼梯,反转每次旋转并增加一些间距:
abcd dcba bcda adcb cdab badc dabccbad
这是code-golf,因此以字节为单位的最短代码获胜,并且适用标签的标准规则。
测试用例
输入:
abcd
,输出:abcd dcba bcda adcb cdab badc dabccbad
输入:
aaaa
,输出:aaaa aaaa aaaa aaaa aaaa aaaa aaaaaaaa
输入:
Code golf
,输出(注意空格):Code golf flog edoC ode golfC Cflog edo de golfCo oCflog ed e golfCod doCflog e golfCode edoCflog golfCode edoCflog olfCode g g edoCflo lfCode go og edoCfl fCode gollog edoCf
dab
C。-------