该站点上的代码正在迅速耗尽。我们需要投资可再生能源。因此,您必须编写一个使用字符串并将其转换为风车的程序。
挑战
让我们以一个简单的风车弦为例。拿弦abc
。该枢纽为中心的性格,在这种情况下b
。由于字符串的长度为3个字符,因此每个输出将恰好是三行高和三个字符宽。这是步骤1的输出。(请注意空格)
abc
要进行下一步,请顺时针旋转每个字符。这是步骤2:
一种 b C
这是步骤3-8:
一种 b C
一种 b C
cba
C b 一种
C b 一种
C b 一种
在第九步中,它绕到原始字符串整圈:
abc
注意b
整个时间都停留在同一地点。这是因为b
是关键人物。您必须编写一个将字符串作为输入的程序或函数,并重复打印此序列,直到关闭该程序。
澄清说明
所有输入字符串将具有奇数个字符。(以便每个风车都有一个枢轴)
为了简化挑战,所有字符串将仅包含大写和小写字母字符。
输出必须是
len(input_string)
宽而高的字符。只要您继续旋转并永远循环,就从序列的哪一步开始无关紧要。
更多测试IO:
由于帖子已经很长了,因此以下是“ windmill”输出的链接:
边注:
由于这应该是风车,所以如果您包含一些样板代码以使其具有较小的时间延迟或在每个步骤之间由用户输入动画效果,那就太好了。但是,由于某些语言没有内置时间,因此这不是强制性的。您提交内容的竞争部分可以尽快打印序列。