String rotation - output string repeatedly moving first character to the end











up vote
15
down vote

favorite
1












The challenge here is to take a string and output all its rotations, by repeatedly moving the first character to the end, once per character in the string, ending with the original string:



john -> ohnj, hnjo, njoh, john


You may also cycle in the other direction, moving characters from the end:



john -> njoh, hnjo, ohnj, john


You should still output one rotation per letter even if the original word is reached before that:



heehee -> eeheeh, eheehe, heehee, eeheeh, eheehe, heehee


Character arrays are allowed, as long as the result works as shown above.



Shortest answer wins!










share|improve this question









New contributor




I_P_Edwards is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 5




    If a string like heehee returns to the original order in fewer cycles than its length, do we stop there? I expect this would make a big difference for many answers.
    – xnor
    Dec 8 at 22:43












  • May we cycle in the other direction?
    – xnor
    Dec 8 at 22:45






  • 2




    I edited the question including your clarifications, feel free to change it if it's not what you intended.
    – xnor
    Dec 8 at 23:28






  • 1




    @xnor that looks much clearer than my original post, thanks so much!
    – I_P_Edwards
    Dec 9 at 13:38






  • 1




    Are we allowed to input/output character arrays? (The distinction can be important in some languages.)
    – LegionMammal978
    Dec 9 at 18:09















up vote
15
down vote

favorite
1












The challenge here is to take a string and output all its rotations, by repeatedly moving the first character to the end, once per character in the string, ending with the original string:



john -> ohnj, hnjo, njoh, john


You may also cycle in the other direction, moving characters from the end:



john -> njoh, hnjo, ohnj, john


You should still output one rotation per letter even if the original word is reached before that:



heehee -> eeheeh, eheehe, heehee, eeheeh, eheehe, heehee


Character arrays are allowed, as long as the result works as shown above.



Shortest answer wins!










share|improve this question









New contributor




I_P_Edwards is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 5




    If a string like heehee returns to the original order in fewer cycles than its length, do we stop there? I expect this would make a big difference for many answers.
    – xnor
    Dec 8 at 22:43












  • May we cycle in the other direction?
    – xnor
    Dec 8 at 22:45






  • 2




    I edited the question including your clarifications, feel free to change it if it's not what you intended.
    – xnor
    Dec 8 at 23:28






  • 1




    @xnor that looks much clearer than my original post, thanks so much!
    – I_P_Edwards
    Dec 9 at 13:38






  • 1




    Are we allowed to input/output character arrays? (The distinction can be important in some languages.)
    – LegionMammal978
    Dec 9 at 18:09













up vote
15
down vote

favorite
1









up vote
15
down vote

favorite
1






1





The challenge here is to take a string and output all its rotations, by repeatedly moving the first character to the end, once per character in the string, ending with the original string:



john -> ohnj, hnjo, njoh, john


You may also cycle in the other direction, moving characters from the end:



john -> njoh, hnjo, ohnj, john


You should still output one rotation per letter even if the original word is reached before that:



heehee -> eeheeh, eheehe, heehee, eeheeh, eheehe, heehee


Character arrays are allowed, as long as the result works as shown above.



Shortest answer wins!










share|improve this question









New contributor




I_P_Edwards is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











The challenge here is to take a string and output all its rotations, by repeatedly moving the first character to the end, once per character in the string, ending with the original string:



john -> ohnj, hnjo, njoh, john


You may also cycle in the other direction, moving characters from the end:



john -> njoh, hnjo, ohnj, john


You should still output one rotation per letter even if the original word is reached before that:



heehee -> eeheeh, eheehe, heehee, eeheeh, eheehe, heehee


Character arrays are allowed, as long as the result works as shown above.



Shortest answer wins!







code-golf string






share|improve this question









New contributor




I_P_Edwards is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




I_P_Edwards is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Dec 9 at 20:44





















New contributor




I_P_Edwards is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Dec 8 at 22:14









I_P_Edwards

786




786




New contributor




I_P_Edwards is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





I_P_Edwards is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






I_P_Edwards is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 5




    If a string like heehee returns to the original order in fewer cycles than its length, do we stop there? I expect this would make a big difference for many answers.
    – xnor
    Dec 8 at 22:43












  • May we cycle in the other direction?
    – xnor
    Dec 8 at 22:45






  • 2




    I edited the question including your clarifications, feel free to change it if it's not what you intended.
    – xnor
    Dec 8 at 23:28






  • 1




    @xnor that looks much clearer than my original post, thanks so much!
    – I_P_Edwards
    Dec 9 at 13:38






  • 1




    Are we allowed to input/output character arrays? (The distinction can be important in some languages.)
    – LegionMammal978
    Dec 9 at 18:09














  • 5




    If a string like heehee returns to the original order in fewer cycles than its length, do we stop there? I expect this would make a big difference for many answers.
    – xnor
    Dec 8 at 22:43












  • May we cycle in the other direction?
    – xnor
    Dec 8 at 22:45






  • 2




    I edited the question including your clarifications, feel free to change it if it's not what you intended.
    – xnor
    Dec 8 at 23:28






  • 1




    @xnor that looks much clearer than my original post, thanks so much!
    – I_P_Edwards
    Dec 9 at 13:38






  • 1




    Are we allowed to input/output character arrays? (The distinction can be important in some languages.)
    – LegionMammal978
    Dec 9 at 18:09








5




5




If a string like heehee returns to the original order in fewer cycles than its length, do we stop there? I expect this would make a big difference for many answers.
– xnor
Dec 8 at 22:43






If a string like heehee returns to the original order in fewer cycles than its length, do we stop there? I expect this would make a big difference for many answers.
– xnor
Dec 8 at 22:43














May we cycle in the other direction?
– xnor
Dec 8 at 22:45




May we cycle in the other direction?
– xnor
Dec 8 at 22:45




2




2




I edited the question including your clarifications, feel free to change it if it's not what you intended.
– xnor
Dec 8 at 23:28




I edited the question including your clarifications, feel free to change it if it's not what you intended.
– xnor
Dec 8 at 23:28




1




1




@xnor that looks much clearer than my original post, thanks so much!
– I_P_Edwards
Dec 9 at 13:38




@xnor that looks much clearer than my original post, thanks so much!
– I_P_Edwards
Dec 9 at 13:38




1




1




Are we allowed to input/output character arrays? (The distinction can be important in some languages.)
– LegionMammal978
Dec 9 at 18:09




Are we allowed to input/output character arrays? (The distinction can be important in some languages.)
– LegionMammal978
Dec 9 at 18:09










38 Answers
38






active

oldest

votes













1 2
next











up vote
4
down vote



accepted











Jelly, 2 bytes



ṙJ


A monadic Link accepting a list of characters which yields a list of lists of characters



Try it online! (footer pretty prints by calling the link and joining with newline characters)






share|improve this answer






























    up vote
    6
    down vote













    Haskell, 27 bytes



    scanl((a:b)_->b++[a])=<<id


    Try it online!






    share|improve this answer




























      up vote
      5
      down vote














      APL (Dyalog Unicode), 6 bytesSBCS





      ⍳∘≢⌽¨⊂


      Try it online!



       the indices



       of



       the tally



      ⌽¨ each rotate (to the left)



       the entire string






      share|improve this answer




























        up vote
        5
        down vote













        JavaScript (ES6), 37 32 bytes



        Returns an array of strings.



        s=>[...s].map(c=>s=s.slice(1)+c)


        Try it online!






        share|improve this answer






























          up vote
          4
          down vote














          Python 2, 38 bytes





          s=input()
          for c in s:s=s[1:]+c;print s


          Try it online!






          share|improve this answer





















          • Python 3 is only 9 more bytes.
            – wizzwizz4
            Dec 9 at 18:42










          • @wizzwizz4 Where'd you get 9? Python 3 - 39 bytes (stdin input without quotes)
            – pizzapants184
            Dec 12 at 6:09










          • @pizzapants184 I forgot that strings were immutable; you're right; it's only 1 more byte.
            – wizzwizz4
            Dec 12 at 6:56


















          up vote
          4
          down vote













          Japt, 5 3 bytes



          Takes input as a character array, outputs an array of character arrays



          £=é


          Try it here



                  :Implicit input of character array U
          £ :Map
          é : Rotate right
          = : Reassign to U for next iteration





          share|improve this answer






























            up vote
            3
            down vote














            MATL, 6 5 bytes



            tf&+)


            1 byte saved thanks to @luis!



            Try it at MATL Online!



            Explanation:



                # Implicitly grab input string
            t # Duplicate the input
            f # Create an array [1, ..., N] where N is the number of characters in the input
            &+ # Add the transpose of this array to itself to create a 2D array of indices
            #
            # + 1 2 3 4
            # ----------
            # 1 | 2 3 4 5
            # 2 | 3 4 5 6
            # 3 | 4 5 6 7
            # 4 | 5 6 7 8
            #
            ) # Use this 2D array to index into the original string using periodic indexing
            # Implicitly display the resulting character array





            share|improve this answer























            • @LuisMendo Clever! Thanks!
              – Suever
              2 days ago


















            up vote
            2
            down vote














            05AB1E, 3 bytes



            ā._


            Try it online!






            share|improve this answer






























              up vote
              2
              down vote














              Attache, 13 bytes



              Rotate#{1:#_}


              Try it online!



              Explanation



              Rotate#{1:#_}
              # fork(f, g) = ${ f[x, g[x]] }; this forks:
              Rotate rotate's the input by
              {1:#_} each number from 1 to the length of the input


              Alternatives



              15 bytes: {_&Rotate!1:#_}



              16 bytes: {Rotate[_,1:#_]}



              16 bytes: Rotate@Rotations



              16 bytes: Rotate#(1&`:@`#)



              17 bytes: Rotate#{1+Iota@_}



              18 bytes: Rotate#(1&`+@Iota)



              19 bytes: Rotate#(Succ=>Iota)






              share|improve this answer




























                up vote
                2
                down vote














                R, 58 bytes





                function(s,`[`=substring)paste0(s[n<-nchar(s):1],s[1,n-1])


                Try it online!






                share|improve this answer




























                  up vote
                  2
                  down vote














                  brainfuck, 59 bytes



                  ,[>,]<[>>[>]+[<]<[<]>-[[>]>[>]<+[<]<[<]>-]>[.>]>[.>]<[<].<]


                  Try it online!



                  Outputs each string separated by null bytes.



                  Explanation:



                  ,[>,]    # Get input
                  <[ # Start loop over input
                  >>[>] # Go to end of the string
                  + # Set it to one to mark it
                  [<]<[<]> # Move to the beginning of input
                  -[[>]>[>]<+[<]<[<]>-] # Transfer the first character to the end
                  >[.>]>[.>] # Print the rotated string
                  <[<]. # Print a nul byte
                  <] # Repeat loop while input





                  share|improve this answer




























                    up vote
                    2
                    down vote














                    Wolfram Language (Mathematica), 35 26 bytes



                    Partition[#,Tr[1^#],1,-1]&


                    Try it online!



                    Takes a list of characters as input.



                    Partition (but not its variant StringPartitionused below) has an optional fourth argument for treating its input as cyclic (and for specifying how exactly to do so), which makes this solution simpler than the string one - in addition to not having any 15-character built-in functions.




                    Wolfram Language (Mathematica), 44 bytes



                    Rest@StringPartition[#<>#,StringLength@#,1]&


                    Try it online!



                    The same, but takes a string as input.



                    Turns "john" into "johnjohn", then takes all the length-StringLength["john"] substrings of this string with offset 1, producing {"john","ohnj","hnjo","njoh","john"}, then drops the first of these with Rest.






                    share|improve this answer























                    • Since character arrays are allowed, Rest@Partition[#~Join~#,Length@#,1]& would be 36 bytes.
                      – LegionMammal978
                      Dec 9 at 22:23










                    • @LegionMammal978 Thanks! There's probably also a shorter approach with character arrays, though I haven't thought of anything yet.
                      – Misha Lavrov
                      Dec 9 at 22:45




















                    up vote
                    1
                    down vote














                    Charcoal, 10 bytes



                    ⮌Eθ⭆θ§θ⁻μκ


                    Try it online! Link is to verbose version of code. Explanation:



                      θ         Input string
                    E Map over characters
                    θ Input string
                    ⭆ Map over characters and join
                    θ Input string
                    § Circularly indexed by
                    ⁻ Difference between
                    μ Inner index
                    κ Outer index
                    ⮌ Reversed
                    Implicitly print each string on its own line


                    To rotate in the opposite direction, replace Minus with Plus.






                    share|improve this answer




























                      up vote
                      1
                      down vote














                      J, 7 bytes



                      #|."{]


                      Try it online!



                      Explanation:



                        |."{    - rotate ( "{ is short for "0 1 - rank 0 1 ) 
                      ] - the input
                      # - lenght of the successive prefixes of the input





                      share|improve this answer

















                      • 1




                        Using " like that is very clever, and requires dictionary knowledge of the language. Is there also a verb with rank 1 0?
                        – Adám
                        Dec 9 at 16:24










                      • @Adám I think it's "#:. I learnt this here from Frownyfrog
                        – Galen Ivanov
                        Dec 9 at 18:34




















                      up vote
                      1
                      down vote














                      Red, 49 43 bytes



                      func[s][forall s[print move head s tail s]]


                      Try it online!






                      share|improve this answer






























                        up vote
                        1
                        down vote














                        Python 2, 54 48 bytes





                        lambda i:[i[x:]+i[:x]for x in range(1,len(i)+1)]


                        Try it online!



                        Well beaten by xnor but posted as an alternative approach anyway.






                        share|improve this answer






























                          up vote
                          1
                          down vote














                          Perl 6, 32 bytes



                          {m:ex/^(.*)(.+)$/».&{[R~] @$_}}


                          Try it online!



                          m:ex/^(.*)(.+)$/ exhaustively matches the given regex, splitting the input string at every possible place, except that the second substring must have at least one character--that prevents the input string from showing up twice in the output. Then each of the resulting Match objects' capture groups are reduced () to a single string with R~, the reversed string concatenation operator.






                          share|improve this answer




























                            up vote
                            1
                            down vote














                            C# (Visual C# Interactive Compiler), 34 bytes





                            x=>x.Select(c=>x=x.Substring(1)+c)


                            Try it online!






                            share|improve this answer






























                              up vote
                              1
                              down vote














                              V, 8 bytes



                              ýñx$pÙñd


                              Try it online!



                              Hexdump:



                              00000000: fdf1 7824 70d9 f164                      ..x$p..d





                              share|improve this answer























                              • ýñx$pÙñd gives 8 by removing the need to H tio.run/##K/v///DewxsrVAoOzzy8MeX/f6/8jDwA
                                – Cows quack
                                Dec 9 at 19:43










                              • @Cowsquack Even better: ý<M-->ñx$pÙ
                                – DJMcMayhem
                                Dec 9 at 20:54










                              • Doesn't that repeat the last line?
                                – Cows quack
                                Dec 10 at 6:18


















                              up vote
                              1
                              down vote














                              Tcl, 80 91 bytes



                              proc P s {time {puts [set s [string ra $s 1 e][string in $s 0]]} [string le $s]}


                              Try it online!






                              share|improve this answer























                              • Reassign text at each time saves some bytes proc R t {time {puts [set t [string ra $t 1 end][string in $t 0]]} [string len $t]}
                                – david
                                Dec 9 at 18:05










                              • Got it down to 80 bytes, thanks to @david
                                – sergiol
                                Dec 10 at 10:54


















                              up vote
                              1
                              down vote













                              C (32-bit), 58 51 bytes





                              i;f(s){for(i=0;i++<printf("%s%.*sn",s+i,i,s)-2;);}


                              Try it online!



                              Degolf



                              i;           // "Global" i.
                              f(s){ // s is pointer to string, which conveniently fits in a 32 bit integer.
                              for(i=0; // Initialize i.
                              // Post-increment i, compare to return value of printf,
                              // which just happens to be the number of chars printed, i.e.
                              // the length of string s plus 1. Because the printf() is
                              // evaluated before the comparison, we need to deduct 2 instead
                              // of 1 from the return value.
                              i++ < printf("%s%.*sn",s+i,i,s);)-2;
                              // The printf prints two strings: first until the terminating ,
                              // the second until a or until i chars have been printed.
                              }





                              share|improve this answer






























                                up vote
                                1
                                down vote














                                Ruby, 39 bytes





                                ->s{a=s.chars.to_a;a.map{a.rotate!*''}}


                                Try it online!






                                share|improve this answer










                                New contributor




                                acornellier is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                Check out our Code of Conduct.














                                • 1




                                  Welcome to the site! It doesn't look like your TIO link corresponds to your answer. It also seems your answer doesn't fit with our input/output requirements. You can use either a function or STDIN/STDOUT but we don't allow variable reassignment.
                                  – Post Left Garf Hunter
                                  Dec 11 at 5:10










                                • Thanks Garf. Not sure how I managed to mess both of those up. Should be all good now.
                                  – acornellier
                                  2 days ago


















                                up vote
                                0
                                down vote














                                Pyth, 11 bytes



                                VSlQ+>QN<QN


                                Try it online!



                                Pretty much just a port of my Python answer



                                Explanation



                                ==================================================
                                assign('Q',eval_input())
                                for N in num_to_range(Psorted(Plen(Q))):
                                imp_print(plus(gt(Q,N),lt(Q,N)))
                                ==================================================

                                V # for N in
                                S # 1-indexed range
                                lQ # length of evaluated input
                                + # concatanate
                                >QN # all characters after index N in Q (Q[N:])
                                <QN # and all characters before index N in Q (Q[:N])





                                share|improve this answer






























                                  up vote
                                  0
                                  down vote














                                  Tcl, 78 bytes



                                  proc R t {time {puts [set t [regsub -all (.?)(.*) $t {21}]]} [string le $t]}


                                  Try it online!






                                  share|improve this answer




























                                    up vote
                                    0
                                    down vote














                                    Pushy, 4 bytes



                                    L:{"


                                    Try it online!



                                    L:     Length of the string times do:
                                    { Cyclically shift left once
                                    " Print





                                    share|improve this answer




























                                      up vote
                                      0
                                      down vote














                                      Perl 6, 20 bytes





                                      {.rotate(all 1..$_)}


                                      Try it online!



                                      Anonymous code block that has input/output as a list of characters. The output is a Junction object that contains all the rotated arrays. I'm not sure how legal this is, since extracting values from a Junction is not normal.



                                      Explanation:



                                      {                  }   # Anonymous codeblock
                                      .rotate( ) # Rotate the input list
                                      all 1..$_ # By all of the range 1 to length of the input array
                                      # all creates a junction of values
                                      # And it runs the function on each value


                                      The all can be replaced by any of any, one, [&], [|], [^].



                                      If the Junction isn't allowed, here's an alternate solution for 22 bytes:





                                      {.&{.rotate(++$)xx$_}}


                                      Try it online!



                                      There's probably a better way to reset the anonymous variable ++$ than by wrapping the code in another code block...






                                      share|improve this answer




























                                        up vote
                                        0
                                        down vote













                                        JavaScript, 48 43 bytes



                                        -5 bytes courtesy of @Bubbler



                                        s=>[...s].map(_=>([a,...b]=s,s=b.join``+a))


                                        Try it online!






                                        share|improve this answer



















                                        • 1




                                          43 bytes.
                                          – Bubbler
                                          Dec 10 at 1:54




















                                        up vote
                                        0
                                        down vote













                                        Powershell, 44 bytes





                                        ($s=$args|% t*y)|%{$h,$t=$s;-join($s=$t+$h)}


                                        Test script:



                                        $f = {

                                        ($s=$args|% t*y)|%{$h,$t=$s;-join($s=$t+$h)}

                                        }

                                        @(
                                        ,('john', 'ohnj', 'hnjo', 'njoh', 'john')
                                        ,('heehee', 'eeheeh', 'eheehe', 'heehee', 'eeheeh', 'eheehe', 'heehee')
                                        ) | % {
                                        $s,$expected = $_
                                        $result = &$f $s
                                        "$result"-eq"$expected"
                                        $result
                                        }


                                        output:



                                        True
                                        ohnj
                                        hnjo
                                        njoh
                                        john
                                        True
                                        eeheeh
                                        eheehe
                                        heehee
                                        eeheeh
                                        eheehe
                                        heehee





                                        share|improve this answer




























                                          up vote
                                          0
                                          down vote














                                          Pepe, 64 bytes



                                          REEeRREeeeREEEEEREErEEEEErRREEEEEEEREEEeeReReeeReeErRrEEEEEEERee


                                          Try it online! Uses newlines for separation.






                                          share|improve this answer




























                                            up vote
                                            0
                                            down vote














                                            Java (JDK), 85 bytes





                                            s->{for(int i=s.length();i-->0;)System.out.println(s.substring(i)+s.substring(0,i));}


                                            Try it online!






                                            share|improve this answer



























                                              1 2
                                              next



                                              Your Answer





                                              StackExchange.ifUsing("editor", function () {
                                              return StackExchange.using("mathjaxEditing", function () {
                                              StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
                                              StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
                                              });
                                              });
                                              }, "mathjax-editing");

                                              StackExchange.ifUsing("editor", function () {
                                              StackExchange.using("externalEditor", function () {
                                              StackExchange.using("snippets", function () {
                                              StackExchange.snippets.init();
                                              });
                                              });
                                              }, "code-snippets");

                                              StackExchange.ready(function() {
                                              var channelOptions = {
                                              tags: "".split(" "),
                                              id: "200"
                                              };
                                              initTagRenderer("".split(" "), "".split(" "), channelOptions);

                                              StackExchange.using("externalEditor", function() {
                                              // Have to fire editor after snippets, if snippets enabled
                                              if (StackExchange.settings.snippets.snippetsEnabled) {
                                              StackExchange.using("snippets", function() {
                                              createEditor();
                                              });
                                              }
                                              else {
                                              createEditor();
                                              }
                                              });

                                              function createEditor() {
                                              StackExchange.prepareEditor({
                                              heartbeatType: 'answer',
                                              convertImagesToLinks: false,
                                              noModals: true,
                                              showLowRepImageUploadWarning: true,
                                              reputationToPostImages: null,
                                              bindNavPrevention: true,
                                              postfix: "",
                                              imageUploader: {
                                              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                                              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                                              allowUrls: true
                                              },
                                              onDemand: true,
                                              discardSelector: ".discard-answer"
                                              ,immediatelyShowMarkdownHelp:true
                                              });


                                              }
                                              });






                                              I_P_Edwards is a new contributor. Be nice, and check out our Code of Conduct.










                                              draft saved

                                              draft discarded


















                                              StackExchange.ready(
                                              function () {
                                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f177221%2fstring-rotation-output-string-repeatedly-moving-first-character-to-the-end%23new-answer', 'question_page');
                                              }
                                              );

                                              Post as a guest















                                              Required, but never shown

























                                              38 Answers
                                              38






                                              active

                                              oldest

                                              votes








                                              38 Answers
                                              38






                                              active

                                              oldest

                                              votes









                                              active

                                              oldest

                                              votes






                                              active

                                              oldest

                                              votes








                                              1 2
                                              next









                                              up vote
                                              4
                                              down vote



                                              accepted











                                              Jelly, 2 bytes



                                              ṙJ


                                              A monadic Link accepting a list of characters which yields a list of lists of characters



                                              Try it online! (footer pretty prints by calling the link and joining with newline characters)






                                              share|improve this answer



























                                                up vote
                                                4
                                                down vote



                                                accepted











                                                Jelly, 2 bytes



                                                ṙJ


                                                A monadic Link accepting a list of characters which yields a list of lists of characters



                                                Try it online! (footer pretty prints by calling the link and joining with newline characters)






                                                share|improve this answer

























                                                  up vote
                                                  4
                                                  down vote



                                                  accepted







                                                  up vote
                                                  4
                                                  down vote



                                                  accepted







                                                  Jelly, 2 bytes



                                                  ṙJ


                                                  A monadic Link accepting a list of characters which yields a list of lists of characters



                                                  Try it online! (footer pretty prints by calling the link and joining with newline characters)






                                                  share|improve this answer















                                                  Jelly, 2 bytes



                                                  ṙJ


                                                  A monadic Link accepting a list of characters which yields a list of lists of characters



                                                  Try it online! (footer pretty prints by calling the link and joining with newline characters)







                                                  share|improve this answer














                                                  share|improve this answer



                                                  share|improve this answer








                                                  edited Dec 8 at 23:30

























                                                  answered Dec 8 at 22:53









                                                  Jonathan Allan

                                                  50.6k534165




                                                  50.6k534165






















                                                      up vote
                                                      6
                                                      down vote













                                                      Haskell, 27 bytes



                                                      scanl((a:b)_->b++[a])=<<id


                                                      Try it online!






                                                      share|improve this answer

























                                                        up vote
                                                        6
                                                        down vote













                                                        Haskell, 27 bytes



                                                        scanl((a:b)_->b++[a])=<<id


                                                        Try it online!






                                                        share|improve this answer























                                                          up vote
                                                          6
                                                          down vote










                                                          up vote
                                                          6
                                                          down vote









                                                          Haskell, 27 bytes



                                                          scanl((a:b)_->b++[a])=<<id


                                                          Try it online!






                                                          share|improve this answer












                                                          Haskell, 27 bytes



                                                          scanl((a:b)_->b++[a])=<<id


                                                          Try it online!







                                                          share|improve this answer












                                                          share|improve this answer



                                                          share|improve this answer










                                                          answered Dec 8 at 22:41









                                                          nimi

                                                          31.1k31985




                                                          31.1k31985






















                                                              up vote
                                                              5
                                                              down vote














                                                              APL (Dyalog Unicode), 6 bytesSBCS





                                                              ⍳∘≢⌽¨⊂


                                                              Try it online!



                                                               the indices



                                                               of



                                                               the tally



                                                              ⌽¨ each rotate (to the left)



                                                               the entire string






                                                              share|improve this answer

























                                                                up vote
                                                                5
                                                                down vote














                                                                APL (Dyalog Unicode), 6 bytesSBCS





                                                                ⍳∘≢⌽¨⊂


                                                                Try it online!



                                                                 the indices



                                                                 of



                                                                 the tally



                                                                ⌽¨ each rotate (to the left)



                                                                 the entire string






                                                                share|improve this answer























                                                                  up vote
                                                                  5
                                                                  down vote










                                                                  up vote
                                                                  5
                                                                  down vote










                                                                  APL (Dyalog Unicode), 6 bytesSBCS





                                                                  ⍳∘≢⌽¨⊂


                                                                  Try it online!



                                                                   the indices



                                                                   of



                                                                   the tally



                                                                  ⌽¨ each rotate (to the left)



                                                                   the entire string






                                                                  share|improve this answer













                                                                  APL (Dyalog Unicode), 6 bytesSBCS





                                                                  ⍳∘≢⌽¨⊂


                                                                  Try it online!



                                                                   the indices



                                                                   of



                                                                   the tally



                                                                  ⌽¨ each rotate (to the left)



                                                                   the entire string







                                                                  share|improve this answer












                                                                  share|improve this answer



                                                                  share|improve this answer










                                                                  answered Dec 8 at 22:22









                                                                  Adám

                                                                  28.5k269188




                                                                  28.5k269188






















                                                                      up vote
                                                                      5
                                                                      down vote













                                                                      JavaScript (ES6), 37 32 bytes



                                                                      Returns an array of strings.



                                                                      s=>[...s].map(c=>s=s.slice(1)+c)


                                                                      Try it online!






                                                                      share|improve this answer



























                                                                        up vote
                                                                        5
                                                                        down vote













                                                                        JavaScript (ES6), 37 32 bytes



                                                                        Returns an array of strings.



                                                                        s=>[...s].map(c=>s=s.slice(1)+c)


                                                                        Try it online!






                                                                        share|improve this answer

























                                                                          up vote
                                                                          5
                                                                          down vote










                                                                          up vote
                                                                          5
                                                                          down vote









                                                                          JavaScript (ES6), 37 32 bytes



                                                                          Returns an array of strings.



                                                                          s=>[...s].map(c=>s=s.slice(1)+c)


                                                                          Try it online!






                                                                          share|improve this answer














                                                                          JavaScript (ES6), 37 32 bytes



                                                                          Returns an array of strings.



                                                                          s=>[...s].map(c=>s=s.slice(1)+c)


                                                                          Try it online!







                                                                          share|improve this answer














                                                                          share|improve this answer



                                                                          share|improve this answer








                                                                          edited Dec 11 at 20:33

























                                                                          answered Dec 8 at 23:28









                                                                          Arnauld

                                                                          71.6k688299




                                                                          71.6k688299






















                                                                              up vote
                                                                              4
                                                                              down vote














                                                                              Python 2, 38 bytes





                                                                              s=input()
                                                                              for c in s:s=s[1:]+c;print s


                                                                              Try it online!






                                                                              share|improve this answer





















                                                                              • Python 3 is only 9 more bytes.
                                                                                – wizzwizz4
                                                                                Dec 9 at 18:42










                                                                              • @wizzwizz4 Where'd you get 9? Python 3 - 39 bytes (stdin input without quotes)
                                                                                – pizzapants184
                                                                                Dec 12 at 6:09










                                                                              • @pizzapants184 I forgot that strings were immutable; you're right; it's only 1 more byte.
                                                                                – wizzwizz4
                                                                                Dec 12 at 6:56















                                                                              up vote
                                                                              4
                                                                              down vote














                                                                              Python 2, 38 bytes





                                                                              s=input()
                                                                              for c in s:s=s[1:]+c;print s


                                                                              Try it online!






                                                                              share|improve this answer





















                                                                              • Python 3 is only 9 more bytes.
                                                                                – wizzwizz4
                                                                                Dec 9 at 18:42










                                                                              • @wizzwizz4 Where'd you get 9? Python 3 - 39 bytes (stdin input without quotes)
                                                                                – pizzapants184
                                                                                Dec 12 at 6:09










                                                                              • @pizzapants184 I forgot that strings were immutable; you're right; it's only 1 more byte.
                                                                                – wizzwizz4
                                                                                Dec 12 at 6:56













                                                                              up vote
                                                                              4
                                                                              down vote










                                                                              up vote
                                                                              4
                                                                              down vote










                                                                              Python 2, 38 bytes





                                                                              s=input()
                                                                              for c in s:s=s[1:]+c;print s


                                                                              Try it online!






                                                                              share|improve this answer













                                                                              Python 2, 38 bytes





                                                                              s=input()
                                                                              for c in s:s=s[1:]+c;print s


                                                                              Try it online!







                                                                              share|improve this answer












                                                                              share|improve this answer



                                                                              share|improve this answer










                                                                              answered Dec 9 at 0:00









                                                                              xnor

                                                                              89.5k18184439




                                                                              89.5k18184439












                                                                              • Python 3 is only 9 more bytes.
                                                                                – wizzwizz4
                                                                                Dec 9 at 18:42










                                                                              • @wizzwizz4 Where'd you get 9? Python 3 - 39 bytes (stdin input without quotes)
                                                                                – pizzapants184
                                                                                Dec 12 at 6:09










                                                                              • @pizzapants184 I forgot that strings were immutable; you're right; it's only 1 more byte.
                                                                                – wizzwizz4
                                                                                Dec 12 at 6:56


















                                                                              • Python 3 is only 9 more bytes.
                                                                                – wizzwizz4
                                                                                Dec 9 at 18:42










                                                                              • @wizzwizz4 Where'd you get 9? Python 3 - 39 bytes (stdin input without quotes)
                                                                                – pizzapants184
                                                                                Dec 12 at 6:09










                                                                              • @pizzapants184 I forgot that strings were immutable; you're right; it's only 1 more byte.
                                                                                – wizzwizz4
                                                                                Dec 12 at 6:56
















                                                                              Python 3 is only 9 more bytes.
                                                                              – wizzwizz4
                                                                              Dec 9 at 18:42




                                                                              Python 3 is only 9 more bytes.
                                                                              – wizzwizz4
                                                                              Dec 9 at 18:42












                                                                              @wizzwizz4 Where'd you get 9? Python 3 - 39 bytes (stdin input without quotes)
                                                                              – pizzapants184
                                                                              Dec 12 at 6:09




                                                                              @wizzwizz4 Where'd you get 9? Python 3 - 39 bytes (stdin input without quotes)
                                                                              – pizzapants184
                                                                              Dec 12 at 6:09












                                                                              @pizzapants184 I forgot that strings were immutable; you're right; it's only 1 more byte.
                                                                              – wizzwizz4
                                                                              Dec 12 at 6:56




                                                                              @pizzapants184 I forgot that strings were immutable; you're right; it's only 1 more byte.
                                                                              – wizzwizz4
                                                                              Dec 12 at 6:56










                                                                              up vote
                                                                              4
                                                                              down vote













                                                                              Japt, 5 3 bytes



                                                                              Takes input as a character array, outputs an array of character arrays



                                                                              £=é


                                                                              Try it here



                                                                                      :Implicit input of character array U
                                                                              £ :Map
                                                                              é : Rotate right
                                                                              = : Reassign to U for next iteration





                                                                              share|improve this answer



























                                                                                up vote
                                                                                4
                                                                                down vote













                                                                                Japt, 5 3 bytes



                                                                                Takes input as a character array, outputs an array of character arrays



                                                                                £=é


                                                                                Try it here



                                                                                        :Implicit input of character array U
                                                                                £ :Map
                                                                                é : Rotate right
                                                                                = : Reassign to U for next iteration





                                                                                share|improve this answer

























                                                                                  up vote
                                                                                  4
                                                                                  down vote










                                                                                  up vote
                                                                                  4
                                                                                  down vote









                                                                                  Japt, 5 3 bytes



                                                                                  Takes input as a character array, outputs an array of character arrays



                                                                                  £=é


                                                                                  Try it here



                                                                                          :Implicit input of character array U
                                                                                  £ :Map
                                                                                  é : Rotate right
                                                                                  = : Reassign to U for next iteration





                                                                                  share|improve this answer














                                                                                  Japt, 5 3 bytes



                                                                                  Takes input as a character array, outputs an array of character arrays



                                                                                  £=é


                                                                                  Try it here



                                                                                          :Implicit input of character array U
                                                                                  £ :Map
                                                                                  é : Rotate right
                                                                                  = : Reassign to U for next iteration






                                                                                  share|improve this answer














                                                                                  share|improve this answer



                                                                                  share|improve this answer








                                                                                  edited Dec 10 at 16:56

























                                                                                  answered Dec 8 at 22:38









                                                                                  Shaggy

                                                                                  18.7k21663




                                                                                  18.7k21663






















                                                                                      up vote
                                                                                      3
                                                                                      down vote














                                                                                      MATL, 6 5 bytes



                                                                                      tf&+)


                                                                                      1 byte saved thanks to @luis!



                                                                                      Try it at MATL Online!



                                                                                      Explanation:



                                                                                          # Implicitly grab input string
                                                                                      t # Duplicate the input
                                                                                      f # Create an array [1, ..., N] where N is the number of characters in the input
                                                                                      &+ # Add the transpose of this array to itself to create a 2D array of indices
                                                                                      #
                                                                                      # + 1 2 3 4
                                                                                      # ----------
                                                                                      # 1 | 2 3 4 5
                                                                                      # 2 | 3 4 5 6
                                                                                      # 3 | 4 5 6 7
                                                                                      # 4 | 5 6 7 8
                                                                                      #
                                                                                      ) # Use this 2D array to index into the original string using periodic indexing
                                                                                      # Implicitly display the resulting character array





                                                                                      share|improve this answer























                                                                                      • @LuisMendo Clever! Thanks!
                                                                                        – Suever
                                                                                        2 days ago















                                                                                      up vote
                                                                                      3
                                                                                      down vote














                                                                                      MATL, 6 5 bytes



                                                                                      tf&+)


                                                                                      1 byte saved thanks to @luis!



                                                                                      Try it at MATL Online!



                                                                                      Explanation:



                                                                                          # Implicitly grab input string
                                                                                      t # Duplicate the input
                                                                                      f # Create an array [1, ..., N] where N is the number of characters in the input
                                                                                      &+ # Add the transpose of this array to itself to create a 2D array of indices
                                                                                      #
                                                                                      # + 1 2 3 4
                                                                                      # ----------
                                                                                      # 1 | 2 3 4 5
                                                                                      # 2 | 3 4 5 6
                                                                                      # 3 | 4 5 6 7
                                                                                      # 4 | 5 6 7 8
                                                                                      #
                                                                                      ) # Use this 2D array to index into the original string using periodic indexing
                                                                                      # Implicitly display the resulting character array





                                                                                      share|improve this answer























                                                                                      • @LuisMendo Clever! Thanks!
                                                                                        – Suever
                                                                                        2 days ago













                                                                                      up vote
                                                                                      3
                                                                                      down vote










                                                                                      up vote
                                                                                      3
                                                                                      down vote










                                                                                      MATL, 6 5 bytes



                                                                                      tf&+)


                                                                                      1 byte saved thanks to @luis!



                                                                                      Try it at MATL Online!



                                                                                      Explanation:



                                                                                          # Implicitly grab input string
                                                                                      t # Duplicate the input
                                                                                      f # Create an array [1, ..., N] where N is the number of characters in the input
                                                                                      &+ # Add the transpose of this array to itself to create a 2D array of indices
                                                                                      #
                                                                                      # + 1 2 3 4
                                                                                      # ----------
                                                                                      # 1 | 2 3 4 5
                                                                                      # 2 | 3 4 5 6
                                                                                      # 3 | 4 5 6 7
                                                                                      # 4 | 5 6 7 8
                                                                                      #
                                                                                      ) # Use this 2D array to index into the original string using periodic indexing
                                                                                      # Implicitly display the resulting character array





                                                                                      share|improve this answer















                                                                                      MATL, 6 5 bytes



                                                                                      tf&+)


                                                                                      1 byte saved thanks to @luis!



                                                                                      Try it at MATL Online!



                                                                                      Explanation:



                                                                                          # Implicitly grab input string
                                                                                      t # Duplicate the input
                                                                                      f # Create an array [1, ..., N] where N is the number of characters in the input
                                                                                      &+ # Add the transpose of this array to itself to create a 2D array of indices
                                                                                      #
                                                                                      # + 1 2 3 4
                                                                                      # ----------
                                                                                      # 1 | 2 3 4 5
                                                                                      # 2 | 3 4 5 6
                                                                                      # 3 | 4 5 6 7
                                                                                      # 4 | 5 6 7 8
                                                                                      #
                                                                                      ) # Use this 2D array to index into the original string using periodic indexing
                                                                                      # Implicitly display the resulting character array






                                                                                      share|improve this answer














                                                                                      share|improve this answer



                                                                                      share|improve this answer








                                                                                      edited 2 days ago

























                                                                                      answered Dec 9 at 21:49









                                                                                      Suever

                                                                                      9,5321345




                                                                                      9,5321345












                                                                                      • @LuisMendo Clever! Thanks!
                                                                                        – Suever
                                                                                        2 days ago


















                                                                                      • @LuisMendo Clever! Thanks!
                                                                                        – Suever
                                                                                        2 days ago
















                                                                                      @LuisMendo Clever! Thanks!
                                                                                      – Suever
                                                                                      2 days ago




                                                                                      @LuisMendo Clever! Thanks!
                                                                                      – Suever
                                                                                      2 days ago










                                                                                      up vote
                                                                                      2
                                                                                      down vote














                                                                                      05AB1E, 3 bytes



                                                                                      ā._


                                                                                      Try it online!






                                                                                      share|improve this answer



























                                                                                        up vote
                                                                                        2
                                                                                        down vote














                                                                                        05AB1E, 3 bytes



                                                                                        ā._


                                                                                        Try it online!






                                                                                        share|improve this answer

























                                                                                          up vote
                                                                                          2
                                                                                          down vote










                                                                                          up vote
                                                                                          2
                                                                                          down vote










                                                                                          05AB1E, 3 bytes



                                                                                          ā._


                                                                                          Try it online!






                                                                                          share|improve this answer















                                                                                          05AB1E, 3 bytes



                                                                                          ā._


                                                                                          Try it online!







                                                                                          share|improve this answer














                                                                                          share|improve this answer



                                                                                          share|improve this answer








                                                                                          edited Dec 8 at 22:58

























                                                                                          answered Dec 8 at 22:28









                                                                                          Okx

                                                                                          12.5k127100




                                                                                          12.5k127100






















                                                                                              up vote
                                                                                              2
                                                                                              down vote














                                                                                              Attache, 13 bytes



                                                                                              Rotate#{1:#_}


                                                                                              Try it online!



                                                                                              Explanation



                                                                                              Rotate#{1:#_}
                                                                                              # fork(f, g) = ${ f[x, g[x]] }; this forks:
                                                                                              Rotate rotate's the input by
                                                                                              {1:#_} each number from 1 to the length of the input


                                                                                              Alternatives



                                                                                              15 bytes: {_&Rotate!1:#_}



                                                                                              16 bytes: {Rotate[_,1:#_]}



                                                                                              16 bytes: Rotate@Rotations



                                                                                              16 bytes: Rotate#(1&`:@`#)



                                                                                              17 bytes: Rotate#{1+Iota@_}



                                                                                              18 bytes: Rotate#(1&`+@Iota)



                                                                                              19 bytes: Rotate#(Succ=>Iota)






                                                                                              share|improve this answer

























                                                                                                up vote
                                                                                                2
                                                                                                down vote














                                                                                                Attache, 13 bytes



                                                                                                Rotate#{1:#_}


                                                                                                Try it online!



                                                                                                Explanation



                                                                                                Rotate#{1:#_}
                                                                                                # fork(f, g) = ${ f[x, g[x]] }; this forks:
                                                                                                Rotate rotate's the input by
                                                                                                {1:#_} each number from 1 to the length of the input


                                                                                                Alternatives



                                                                                                15 bytes: {_&Rotate!1:#_}



                                                                                                16 bytes: {Rotate[_,1:#_]}



                                                                                                16 bytes: Rotate@Rotations



                                                                                                16 bytes: Rotate#(1&`:@`#)



                                                                                                17 bytes: Rotate#{1+Iota@_}



                                                                                                18 bytes: Rotate#(1&`+@Iota)



                                                                                                19 bytes: Rotate#(Succ=>Iota)






                                                                                                share|improve this answer























                                                                                                  up vote
                                                                                                  2
                                                                                                  down vote










                                                                                                  up vote
                                                                                                  2
                                                                                                  down vote










                                                                                                  Attache, 13 bytes



                                                                                                  Rotate#{1:#_}


                                                                                                  Try it online!



                                                                                                  Explanation



                                                                                                  Rotate#{1:#_}
                                                                                                  # fork(f, g) = ${ f[x, g[x]] }; this forks:
                                                                                                  Rotate rotate's the input by
                                                                                                  {1:#_} each number from 1 to the length of the input


                                                                                                  Alternatives



                                                                                                  15 bytes: {_&Rotate!1:#_}



                                                                                                  16 bytes: {Rotate[_,1:#_]}



                                                                                                  16 bytes: Rotate@Rotations



                                                                                                  16 bytes: Rotate#(1&`:@`#)



                                                                                                  17 bytes: Rotate#{1+Iota@_}



                                                                                                  18 bytes: Rotate#(1&`+@Iota)



                                                                                                  19 bytes: Rotate#(Succ=>Iota)






                                                                                                  share|improve this answer













                                                                                                  Attache, 13 bytes



                                                                                                  Rotate#{1:#_}


                                                                                                  Try it online!



                                                                                                  Explanation



                                                                                                  Rotate#{1:#_}
                                                                                                  # fork(f, g) = ${ f[x, g[x]] }; this forks:
                                                                                                  Rotate rotate's the input by
                                                                                                  {1:#_} each number from 1 to the length of the input


                                                                                                  Alternatives



                                                                                                  15 bytes: {_&Rotate!1:#_}



                                                                                                  16 bytes: {Rotate[_,1:#_]}



                                                                                                  16 bytes: Rotate@Rotations



                                                                                                  16 bytes: Rotate#(1&`:@`#)



                                                                                                  17 bytes: Rotate#{1+Iota@_}



                                                                                                  18 bytes: Rotate#(1&`+@Iota)



                                                                                                  19 bytes: Rotate#(Succ=>Iota)







                                                                                                  share|improve this answer












                                                                                                  share|improve this answer



                                                                                                  share|improve this answer










                                                                                                  answered Dec 9 at 0:40









                                                                                                  Conor O'Brien

                                                                                                  28.9k263160




                                                                                                  28.9k263160






















                                                                                                      up vote
                                                                                                      2
                                                                                                      down vote














                                                                                                      R, 58 bytes





                                                                                                      function(s,`[`=substring)paste0(s[n<-nchar(s):1],s[1,n-1])


                                                                                                      Try it online!






                                                                                                      share|improve this answer

























                                                                                                        up vote
                                                                                                        2
                                                                                                        down vote














                                                                                                        R, 58 bytes





                                                                                                        function(s,`[`=substring)paste0(s[n<-nchar(s):1],s[1,n-1])


                                                                                                        Try it online!






                                                                                                        share|improve this answer























                                                                                                          up vote
                                                                                                          2
                                                                                                          down vote










                                                                                                          up vote
                                                                                                          2
                                                                                                          down vote










                                                                                                          R, 58 bytes





                                                                                                          function(s,`[`=substring)paste0(s[n<-nchar(s):1],s[1,n-1])


                                                                                                          Try it online!






                                                                                                          share|improve this answer













                                                                                                          R, 58 bytes





                                                                                                          function(s,`[`=substring)paste0(s[n<-nchar(s):1],s[1,n-1])


                                                                                                          Try it online!







                                                                                                          share|improve this answer












                                                                                                          share|improve this answer



                                                                                                          share|improve this answer










                                                                                                          answered Dec 9 at 17:43









                                                                                                          digEmAll

                                                                                                          2,41148




                                                                                                          2,41148






















                                                                                                              up vote
                                                                                                              2
                                                                                                              down vote














                                                                                                              brainfuck, 59 bytes



                                                                                                              ,[>,]<[>>[>]+[<]<[<]>-[[>]>[>]<+[<]<[<]>-]>[.>]>[.>]<[<].<]


                                                                                                              Try it online!



                                                                                                              Outputs each string separated by null bytes.



                                                                                                              Explanation:



                                                                                                              ,[>,]    # Get input
                                                                                                              <[ # Start loop over input
                                                                                                              >>[>] # Go to end of the string
                                                                                                              + # Set it to one to mark it
                                                                                                              [<]<[<]> # Move to the beginning of input
                                                                                                              -[[>]>[>]<+[<]<[<]>-] # Transfer the first character to the end
                                                                                                              >[.>]>[.>] # Print the rotated string
                                                                                                              <[<]. # Print a nul byte
                                                                                                              <] # Repeat loop while input





                                                                                                              share|improve this answer

























                                                                                                                up vote
                                                                                                                2
                                                                                                                down vote














                                                                                                                brainfuck, 59 bytes



                                                                                                                ,[>,]<[>>[>]+[<]<[<]>-[[>]>[>]<+[<]<[<]>-]>[.>]>[.>]<[<].<]


                                                                                                                Try it online!



                                                                                                                Outputs each string separated by null bytes.



                                                                                                                Explanation:



                                                                                                                ,[>,]    # Get input
                                                                                                                <[ # Start loop over input
                                                                                                                >>[>] # Go to end of the string
                                                                                                                + # Set it to one to mark it
                                                                                                                [<]<[<]> # Move to the beginning of input
                                                                                                                -[[>]>[>]<+[<]<[<]>-] # Transfer the first character to the end
                                                                                                                >[.>]>[.>] # Print the rotated string
                                                                                                                <[<]. # Print a nul byte
                                                                                                                <] # Repeat loop while input





                                                                                                                share|improve this answer























                                                                                                                  up vote
                                                                                                                  2
                                                                                                                  down vote










                                                                                                                  up vote
                                                                                                                  2
                                                                                                                  down vote










                                                                                                                  brainfuck, 59 bytes



                                                                                                                  ,[>,]<[>>[>]+[<]<[<]>-[[>]>[>]<+[<]<[<]>-]>[.>]>[.>]<[<].<]


                                                                                                                  Try it online!



                                                                                                                  Outputs each string separated by null bytes.



                                                                                                                  Explanation:



                                                                                                                  ,[>,]    # Get input
                                                                                                                  <[ # Start loop over input
                                                                                                                  >>[>] # Go to end of the string
                                                                                                                  + # Set it to one to mark it
                                                                                                                  [<]<[<]> # Move to the beginning of input
                                                                                                                  -[[>]>[>]<+[<]<[<]>-] # Transfer the first character to the end
                                                                                                                  >[.>]>[.>] # Print the rotated string
                                                                                                                  <[<]. # Print a nul byte
                                                                                                                  <] # Repeat loop while input





                                                                                                                  share|improve this answer













                                                                                                                  brainfuck, 59 bytes



                                                                                                                  ,[>,]<[>>[>]+[<]<[<]>-[[>]>[>]<+[<]<[<]>-]>[.>]>[.>]<[<].<]


                                                                                                                  Try it online!



                                                                                                                  Outputs each string separated by null bytes.



                                                                                                                  Explanation:



                                                                                                                  ,[>,]    # Get input
                                                                                                                  <[ # Start loop over input
                                                                                                                  >>[>] # Go to end of the string
                                                                                                                  + # Set it to one to mark it
                                                                                                                  [<]<[<]> # Move to the beginning of input
                                                                                                                  -[[>]>[>]<+[<]<[<]>-] # Transfer the first character to the end
                                                                                                                  >[.>]>[.>] # Print the rotated string
                                                                                                                  <[<]. # Print a nul byte
                                                                                                                  <] # Repeat loop while input






                                                                                                                  share|improve this answer












                                                                                                                  share|improve this answer



                                                                                                                  share|improve this answer










                                                                                                                  answered Dec 9 at 23:23









                                                                                                                  Jo King

                                                                                                                  20.4k246108




                                                                                                                  20.4k246108






















                                                                                                                      up vote
                                                                                                                      2
                                                                                                                      down vote














                                                                                                                      Wolfram Language (Mathematica), 35 26 bytes



                                                                                                                      Partition[#,Tr[1^#],1,-1]&


                                                                                                                      Try it online!



                                                                                                                      Takes a list of characters as input.



                                                                                                                      Partition (but not its variant StringPartitionused below) has an optional fourth argument for treating its input as cyclic (and for specifying how exactly to do so), which makes this solution simpler than the string one - in addition to not having any 15-character built-in functions.




                                                                                                                      Wolfram Language (Mathematica), 44 bytes



                                                                                                                      Rest@StringPartition[#<>#,StringLength@#,1]&


                                                                                                                      Try it online!



                                                                                                                      The same, but takes a string as input.



                                                                                                                      Turns "john" into "johnjohn", then takes all the length-StringLength["john"] substrings of this string with offset 1, producing {"john","ohnj","hnjo","njoh","john"}, then drops the first of these with Rest.






                                                                                                                      share|improve this answer























                                                                                                                      • Since character arrays are allowed, Rest@Partition[#~Join~#,Length@#,1]& would be 36 bytes.
                                                                                                                        – LegionMammal978
                                                                                                                        Dec 9 at 22:23










                                                                                                                      • @LegionMammal978 Thanks! There's probably also a shorter approach with character arrays, though I haven't thought of anything yet.
                                                                                                                        – Misha Lavrov
                                                                                                                        Dec 9 at 22:45

















                                                                                                                      up vote
                                                                                                                      2
                                                                                                                      down vote














                                                                                                                      Wolfram Language (Mathematica), 35 26 bytes



                                                                                                                      Partition[#,Tr[1^#],1,-1]&


                                                                                                                      Try it online!



                                                                                                                      Takes a list of characters as input.



                                                                                                                      Partition (but not its variant StringPartitionused below) has an optional fourth argument for treating its input as cyclic (and for specifying how exactly to do so), which makes this solution simpler than the string one - in addition to not having any 15-character built-in functions.




                                                                                                                      Wolfram Language (Mathematica), 44 bytes



                                                                                                                      Rest@StringPartition[#<>#,StringLength@#,1]&


                                                                                                                      Try it online!



                                                                                                                      The same, but takes a string as input.



                                                                                                                      Turns "john" into "johnjohn", then takes all the length-StringLength["john"] substrings of this string with offset 1, producing {"john","ohnj","hnjo","njoh","john"}, then drops the first of these with Rest.






                                                                                                                      share|improve this answer























                                                                                                                      • Since character arrays are allowed, Rest@Partition[#~Join~#,Length@#,1]& would be 36 bytes.
                                                                                                                        – LegionMammal978
                                                                                                                        Dec 9 at 22:23










                                                                                                                      • @LegionMammal978 Thanks! There's probably also a shorter approach with character arrays, though I haven't thought of anything yet.
                                                                                                                        – Misha Lavrov
                                                                                                                        Dec 9 at 22:45















                                                                                                                      up vote
                                                                                                                      2
                                                                                                                      down vote










                                                                                                                      up vote
                                                                                                                      2
                                                                                                                      down vote










                                                                                                                      Wolfram Language (Mathematica), 35 26 bytes



                                                                                                                      Partition[#,Tr[1^#],1,-1]&


                                                                                                                      Try it online!



                                                                                                                      Takes a list of characters as input.



                                                                                                                      Partition (but not its variant StringPartitionused below) has an optional fourth argument for treating its input as cyclic (and for specifying how exactly to do so), which makes this solution simpler than the string one - in addition to not having any 15-character built-in functions.




                                                                                                                      Wolfram Language (Mathematica), 44 bytes



                                                                                                                      Rest@StringPartition[#<>#,StringLength@#,1]&


                                                                                                                      Try it online!



                                                                                                                      The same, but takes a string as input.



                                                                                                                      Turns "john" into "johnjohn", then takes all the length-StringLength["john"] substrings of this string with offset 1, producing {"john","ohnj","hnjo","njoh","john"}, then drops the first of these with Rest.






                                                                                                                      share|improve this answer















                                                                                                                      Wolfram Language (Mathematica), 35 26 bytes



                                                                                                                      Partition[#,Tr[1^#],1,-1]&


                                                                                                                      Try it online!



                                                                                                                      Takes a list of characters as input.



                                                                                                                      Partition (but not its variant StringPartitionused below) has an optional fourth argument for treating its input as cyclic (and for specifying how exactly to do so), which makes this solution simpler than the string one - in addition to not having any 15-character built-in functions.




                                                                                                                      Wolfram Language (Mathematica), 44 bytes



                                                                                                                      Rest@StringPartition[#<>#,StringLength@#,1]&


                                                                                                                      Try it online!



                                                                                                                      The same, but takes a string as input.



                                                                                                                      Turns "john" into "johnjohn", then takes all the length-StringLength["john"] substrings of this string with offset 1, producing {"john","ohnj","hnjo","njoh","john"}, then drops the first of these with Rest.







                                                                                                                      share|improve this answer














                                                                                                                      share|improve this answer



                                                                                                                      share|improve this answer








                                                                                                                      edited 2 days ago

























                                                                                                                      answered Dec 9 at 0:04









                                                                                                                      Misha Lavrov

                                                                                                                      4,121424




                                                                                                                      4,121424












                                                                                                                      • Since character arrays are allowed, Rest@Partition[#~Join~#,Length@#,1]& would be 36 bytes.
                                                                                                                        – LegionMammal978
                                                                                                                        Dec 9 at 22:23










                                                                                                                      • @LegionMammal978 Thanks! There's probably also a shorter approach with character arrays, though I haven't thought of anything yet.
                                                                                                                        – Misha Lavrov
                                                                                                                        Dec 9 at 22:45




















                                                                                                                      • Since character arrays are allowed, Rest@Partition[#~Join~#,Length@#,1]& would be 36 bytes.
                                                                                                                        – LegionMammal978
                                                                                                                        Dec 9 at 22:23










                                                                                                                      • @LegionMammal978 Thanks! There's probably also a shorter approach with character arrays, though I haven't thought of anything yet.
                                                                                                                        – Misha Lavrov
                                                                                                                        Dec 9 at 22:45


















                                                                                                                      Since character arrays are allowed, Rest@Partition[#~Join~#,Length@#,1]& would be 36 bytes.
                                                                                                                      – LegionMammal978
                                                                                                                      Dec 9 at 22:23




                                                                                                                      Since character arrays are allowed, Rest@Partition[#~Join~#,Length@#,1]& would be 36 bytes.
                                                                                                                      – LegionMammal978
                                                                                                                      Dec 9 at 22:23












                                                                                                                      @LegionMammal978 Thanks! There's probably also a shorter approach with character arrays, though I haven't thought of anything yet.
                                                                                                                      – Misha Lavrov
                                                                                                                      Dec 9 at 22:45






                                                                                                                      @LegionMammal978 Thanks! There's probably also a shorter approach with character arrays, though I haven't thought of anything yet.
                                                                                                                      – Misha Lavrov
                                                                                                                      Dec 9 at 22:45












                                                                                                                      up vote
                                                                                                                      1
                                                                                                                      down vote














                                                                                                                      Charcoal, 10 bytes



                                                                                                                      ⮌Eθ⭆θ§θ⁻μκ


                                                                                                                      Try it online! Link is to verbose version of code. Explanation:



                                                                                                                        θ         Input string
                                                                                                                      E Map over characters
                                                                                                                      θ Input string
                                                                                                                      ⭆ Map over characters and join
                                                                                                                      θ Input string
                                                                                                                      § Circularly indexed by
                                                                                                                      ⁻ Difference between
                                                                                                                      μ Inner index
                                                                                                                      κ Outer index
                                                                                                                      ⮌ Reversed
                                                                                                                      Implicitly print each string on its own line


                                                                                                                      To rotate in the opposite direction, replace Minus with Plus.






                                                                                                                      share|improve this answer

























                                                                                                                        up vote
                                                                                                                        1
                                                                                                                        down vote














                                                                                                                        Charcoal, 10 bytes



                                                                                                                        ⮌Eθ⭆θ§θ⁻μκ


                                                                                                                        Try it online! Link is to verbose version of code. Explanation:



                                                                                                                          θ         Input string
                                                                                                                        E Map over characters
                                                                                                                        θ Input string
                                                                                                                        ⭆ Map over characters and join
                                                                                                                        θ Input string
                                                                                                                        § Circularly indexed by
                                                                                                                        ⁻ Difference between
                                                                                                                        μ Inner index
                                                                                                                        κ Outer index
                                                                                                                        ⮌ Reversed
                                                                                                                        Implicitly print each string on its own line


                                                                                                                        To rotate in the opposite direction, replace Minus with Plus.






                                                                                                                        share|improve this answer























                                                                                                                          up vote
                                                                                                                          1
                                                                                                                          down vote










                                                                                                                          up vote
                                                                                                                          1
                                                                                                                          down vote










                                                                                                                          Charcoal, 10 bytes



                                                                                                                          ⮌Eθ⭆θ§θ⁻μκ


                                                                                                                          Try it online! Link is to verbose version of code. Explanation:



                                                                                                                            θ         Input string
                                                                                                                          E Map over characters
                                                                                                                          θ Input string
                                                                                                                          ⭆ Map over characters and join
                                                                                                                          θ Input string
                                                                                                                          § Circularly indexed by
                                                                                                                          ⁻ Difference between
                                                                                                                          μ Inner index
                                                                                                                          κ Outer index
                                                                                                                          ⮌ Reversed
                                                                                                                          Implicitly print each string on its own line


                                                                                                                          To rotate in the opposite direction, replace Minus with Plus.






                                                                                                                          share|improve this answer













                                                                                                                          Charcoal, 10 bytes



                                                                                                                          ⮌Eθ⭆θ§θ⁻μκ


                                                                                                                          Try it online! Link is to verbose version of code. Explanation:



                                                                                                                            θ         Input string
                                                                                                                          E Map over characters
                                                                                                                          θ Input string
                                                                                                                          ⭆ Map over characters and join
                                                                                                                          θ Input string
                                                                                                                          § Circularly indexed by
                                                                                                                          ⁻ Difference between
                                                                                                                          μ Inner index
                                                                                                                          κ Outer index
                                                                                                                          ⮌ Reversed
                                                                                                                          Implicitly print each string on its own line


                                                                                                                          To rotate in the opposite direction, replace Minus with Plus.







                                                                                                                          share|improve this answer












                                                                                                                          share|improve this answer



                                                                                                                          share|improve this answer










                                                                                                                          answered Dec 8 at 23:54









                                                                                                                          Neil

                                                                                                                          78.9k744175




                                                                                                                          78.9k744175






















                                                                                                                              up vote
                                                                                                                              1
                                                                                                                              down vote














                                                                                                                              J, 7 bytes



                                                                                                                              #|."{]


                                                                                                                              Try it online!



                                                                                                                              Explanation:



                                                                                                                                |."{    - rotate ( "{ is short for "0 1 - rank 0 1 ) 
                                                                                                                              ] - the input
                                                                                                                              # - lenght of the successive prefixes of the input





                                                                                                                              share|improve this answer

















                                                                                                                              • 1




                                                                                                                                Using " like that is very clever, and requires dictionary knowledge of the language. Is there also a verb with rank 1 0?
                                                                                                                                – Adám
                                                                                                                                Dec 9 at 16:24










                                                                                                                              • @Adám I think it's "#:. I learnt this here from Frownyfrog
                                                                                                                                – Galen Ivanov
                                                                                                                                Dec 9 at 18:34

















                                                                                                                              up vote
                                                                                                                              1
                                                                                                                              down vote














                                                                                                                              J, 7 bytes



                                                                                                                              #|."{]


                                                                                                                              Try it online!



                                                                                                                              Explanation:



                                                                                                                                |."{    - rotate ( "{ is short for "0 1 - rank 0 1 ) 
                                                                                                                              ] - the input
                                                                                                                              # - lenght of the successive prefixes of the input





                                                                                                                              share|improve this answer

















                                                                                                                              • 1




                                                                                                                                Using " like that is very clever, and requires dictionary knowledge of the language. Is there also a verb with rank 1 0?
                                                                                                                                – Adám
                                                                                                                                Dec 9 at 16:24










                                                                                                                              • @Adám I think it's "#:. I learnt this here from Frownyfrog
                                                                                                                                – Galen Ivanov
                                                                                                                                Dec 9 at 18:34















                                                                                                                              up vote
                                                                                                                              1
                                                                                                                              down vote










                                                                                                                              up vote
                                                                                                                              1
                                                                                                                              down vote










                                                                                                                              J, 7 bytes



                                                                                                                              #|."{]


                                                                                                                              Try it online!



                                                                                                                              Explanation:



                                                                                                                                |."{    - rotate ( "{ is short for "0 1 - rank 0 1 ) 
                                                                                                                              ] - the input
                                                                                                                              # - lenght of the successive prefixes of the input





                                                                                                                              share|improve this answer













                                                                                                                              J, 7 bytes



                                                                                                                              #|."{]


                                                                                                                              Try it online!



                                                                                                                              Explanation:



                                                                                                                                |."{    - rotate ( "{ is short for "0 1 - rank 0 1 ) 
                                                                                                                              ] - the input
                                                                                                                              # - lenght of the successive prefixes of the input






                                                                                                                              share|improve this answer












                                                                                                                              share|improve this answer



                                                                                                                              share|improve this answer










                                                                                                                              answered Dec 9 at 7:52









                                                                                                                              Galen Ivanov

                                                                                                                              6,15711032




                                                                                                                              6,15711032








                                                                                                                              • 1




                                                                                                                                Using " like that is very clever, and requires dictionary knowledge of the language. Is there also a verb with rank 1 0?
                                                                                                                                – Adám
                                                                                                                                Dec 9 at 16:24










                                                                                                                              • @Adám I think it's "#:. I learnt this here from Frownyfrog
                                                                                                                                – Galen Ivanov
                                                                                                                                Dec 9 at 18:34
















                                                                                                                              • 1




                                                                                                                                Using " like that is very clever, and requires dictionary knowledge of the language. Is there also a verb with rank 1 0?
                                                                                                                                – Adám
                                                                                                                                Dec 9 at 16:24










                                                                                                                              • @Adám I think it's "#:. I learnt this here from Frownyfrog
                                                                                                                                – Galen Ivanov
                                                                                                                                Dec 9 at 18:34










                                                                                                                              1




                                                                                                                              1




                                                                                                                              Using " like that is very clever, and requires dictionary knowledge of the language. Is there also a verb with rank 1 0?
                                                                                                                              – Adám
                                                                                                                              Dec 9 at 16:24




                                                                                                                              Using " like that is very clever, and requires dictionary knowledge of the language. Is there also a verb with rank 1 0?
                                                                                                                              – Adám
                                                                                                                              Dec 9 at 16:24












                                                                                                                              @Adám I think it's "#:. I learnt this here from Frownyfrog
                                                                                                                              – Galen Ivanov
                                                                                                                              Dec 9 at 18:34






                                                                                                                              @Adám I think it's "#:. I learnt this here from Frownyfrog
                                                                                                                              – Galen Ivanov
                                                                                                                              Dec 9 at 18:34












                                                                                                                              up vote
                                                                                                                              1
                                                                                                                              down vote














                                                                                                                              Red, 49 43 bytes



                                                                                                                              func[s][forall s[print move head s tail s]]


                                                                                                                              Try it online!






                                                                                                                              share|improve this answer



























                                                                                                                                up vote
                                                                                                                                1
                                                                                                                                down vote














                                                                                                                                Red, 49 43 bytes



                                                                                                                                func[s][forall s[print move head s tail s]]


                                                                                                                                Try it online!






                                                                                                                                share|improve this answer

























                                                                                                                                  up vote
                                                                                                                                  1
                                                                                                                                  down vote










                                                                                                                                  up vote
                                                                                                                                  1
                                                                                                                                  down vote










                                                                                                                                  Red, 49 43 bytes



                                                                                                                                  func[s][forall s[print move head s tail s]]


                                                                                                                                  Try it online!






                                                                                                                                  share|improve this answer















                                                                                                                                  Red, 49 43 bytes



                                                                                                                                  func[s][forall s[print move head s tail s]]


                                                                                                                                  Try it online!







                                                                                                                                  share|improve this answer














                                                                                                                                  share|improve this answer



                                                                                                                                  share|improve this answer








                                                                                                                                  edited Dec 9 at 9:15

























                                                                                                                                  answered Dec 9 at 8:42









                                                                                                                                  Galen Ivanov

                                                                                                                                  6,15711032




                                                                                                                                  6,15711032






















                                                                                                                                      up vote
                                                                                                                                      1
                                                                                                                                      down vote














                                                                                                                                      Python 2, 54 48 bytes





                                                                                                                                      lambda i:[i[x:]+i[:x]for x in range(1,len(i)+1)]


                                                                                                                                      Try it online!



                                                                                                                                      Well beaten by xnor but posted as an alternative approach anyway.






                                                                                                                                      share|improve this answer



























                                                                                                                                        up vote
                                                                                                                                        1
                                                                                                                                        down vote














                                                                                                                                        Python 2, 54 48 bytes





                                                                                                                                        lambda i:[i[x:]+i[:x]for x in range(1,len(i)+1)]


                                                                                                                                        Try it online!



                                                                                                                                        Well beaten by xnor but posted as an alternative approach anyway.






                                                                                                                                        share|improve this answer

























                                                                                                                                          up vote
                                                                                                                                          1
                                                                                                                                          down vote










                                                                                                                                          up vote
                                                                                                                                          1
                                                                                                                                          down vote










                                                                                                                                          Python 2, 54 48 bytes





                                                                                                                                          lambda i:[i[x:]+i[:x]for x in range(1,len(i)+1)]


                                                                                                                                          Try it online!



                                                                                                                                          Well beaten by xnor but posted as an alternative approach anyway.






                                                                                                                                          share|improve this answer















                                                                                                                                          Python 2, 54 48 bytes





                                                                                                                                          lambda i:[i[x:]+i[:x]for x in range(1,len(i)+1)]


                                                                                                                                          Try it online!



                                                                                                                                          Well beaten by xnor but posted as an alternative approach anyway.







                                                                                                                                          share|improve this answer














                                                                                                                                          share|improve this answer



                                                                                                                                          share|improve this answer








                                                                                                                                          edited Dec 9 at 15:56

























                                                                                                                                          answered Dec 9 at 9:03









                                                                                                                                          ElPedro

                                                                                                                                          3,4631023




                                                                                                                                          3,4631023






















                                                                                                                                              up vote
                                                                                                                                              1
                                                                                                                                              down vote














                                                                                                                                              Perl 6, 32 bytes



                                                                                                                                              {m:ex/^(.*)(.+)$/».&{[R~] @$_}}


                                                                                                                                              Try it online!



                                                                                                                                              m:ex/^(.*)(.+)$/ exhaustively matches the given regex, splitting the input string at every possible place, except that the second substring must have at least one character--that prevents the input string from showing up twice in the output. Then each of the resulting Match objects' capture groups are reduced () to a single string with R~, the reversed string concatenation operator.






                                                                                                                                              share|improve this answer

























                                                                                                                                                up vote
                                                                                                                                                1
                                                                                                                                                down vote














                                                                                                                                                Perl 6, 32 bytes



                                                                                                                                                {m:ex/^(.*)(.+)$/».&{[R~] @$_}}


                                                                                                                                                Try it online!



                                                                                                                                                m:ex/^(.*)(.+)$/ exhaustively matches the given regex, splitting the input string at every possible place, except that the second substring must have at least one character--that prevents the input string from showing up twice in the output. Then each of the resulting Match objects' capture groups are reduced () to a single string with R~, the reversed string concatenation operator.






                                                                                                                                                share|improve this answer























                                                                                                                                                  up vote
                                                                                                                                                  1
                                                                                                                                                  down vote










                                                                                                                                                  up vote
                                                                                                                                                  1
                                                                                                                                                  down vote










                                                                                                                                                  Perl 6, 32 bytes



                                                                                                                                                  {m:ex/^(.*)(.+)$/».&{[R~] @$_}}


                                                                                                                                                  Try it online!



                                                                                                                                                  m:ex/^(.*)(.+)$/ exhaustively matches the given regex, splitting the input string at every possible place, except that the second substring must have at least one character--that prevents the input string from showing up twice in the output. Then each of the resulting Match objects' capture groups are reduced () to a single string with R~, the reversed string concatenation operator.






                                                                                                                                                  share|improve this answer













                                                                                                                                                  Perl 6, 32 bytes



                                                                                                                                                  {m:ex/^(.*)(.+)$/».&{[R~] @$_}}


                                                                                                                                                  Try it online!



                                                                                                                                                  m:ex/^(.*)(.+)$/ exhaustively matches the given regex, splitting the input string at every possible place, except that the second substring must have at least one character--that prevents the input string from showing up twice in the output. Then each of the resulting Match objects' capture groups are reduced () to a single string with R~, the reversed string concatenation operator.







                                                                                                                                                  share|improve this answer












                                                                                                                                                  share|improve this answer



                                                                                                                                                  share|improve this answer










                                                                                                                                                  answered Dec 9 at 19:35









                                                                                                                                                  Sean

                                                                                                                                                  3,28636




                                                                                                                                                  3,28636






















                                                                                                                                                      up vote
                                                                                                                                                      1
                                                                                                                                                      down vote














                                                                                                                                                      C# (Visual C# Interactive Compiler), 34 bytes





                                                                                                                                                      x=>x.Select(c=>x=x.Substring(1)+c)


                                                                                                                                                      Try it online!






                                                                                                                                                      share|improve this answer



























                                                                                                                                                        up vote
                                                                                                                                                        1
                                                                                                                                                        down vote














                                                                                                                                                        C# (Visual C# Interactive Compiler), 34 bytes





                                                                                                                                                        x=>x.Select(c=>x=x.Substring(1)+c)


                                                                                                                                                        Try it online!






                                                                                                                                                        share|improve this answer

























                                                                                                                                                          up vote
                                                                                                                                                          1
                                                                                                                                                          down vote










                                                                                                                                                          up vote
                                                                                                                                                          1
                                                                                                                                                          down vote










                                                                                                                                                          C# (Visual C# Interactive Compiler), 34 bytes





                                                                                                                                                          x=>x.Select(c=>x=x.Substring(1)+c)


                                                                                                                                                          Try it online!






                                                                                                                                                          share|improve this answer















                                                                                                                                                          C# (Visual C# Interactive Compiler), 34 bytes





                                                                                                                                                          x=>x.Select(c=>x=x.Substring(1)+c)


                                                                                                                                                          Try it online!







                                                                                                                                                          share|improve this answer














                                                                                                                                                          share|improve this answer



                                                                                                                                                          share|improve this answer








                                                                                                                                                          edited Dec 10 at 1:55

























                                                                                                                                                          answered Dec 9 at 23:26









                                                                                                                                                          dana

                                                                                                                                                          34124




                                                                                                                                                          34124






















                                                                                                                                                              up vote
                                                                                                                                                              1
                                                                                                                                                              down vote














                                                                                                                                                              V, 8 bytes



                                                                                                                                                              ýñx$pÙñd


                                                                                                                                                              Try it online!



                                                                                                                                                              Hexdump:



                                                                                                                                                              00000000: fdf1 7824 70d9 f164                      ..x$p..d





                                                                                                                                                              share|improve this answer























                                                                                                                                                              • ýñx$pÙñd gives 8 by removing the need to H tio.run/##K/v///DewxsrVAoOzzy8MeX/f6/8jDwA
                                                                                                                                                                – Cows quack
                                                                                                                                                                Dec 9 at 19:43










                                                                                                                                                              • @Cowsquack Even better: ý<M-->ñx$pÙ
                                                                                                                                                                – DJMcMayhem
                                                                                                                                                                Dec 9 at 20:54










                                                                                                                                                              • Doesn't that repeat the last line?
                                                                                                                                                                – Cows quack
                                                                                                                                                                Dec 10 at 6:18















                                                                                                                                                              up vote
                                                                                                                                                              1
                                                                                                                                                              down vote














                                                                                                                                                              V, 8 bytes



                                                                                                                                                              ýñx$pÙñd


                                                                                                                                                              Try it online!



                                                                                                                                                              Hexdump:



                                                                                                                                                              00000000: fdf1 7824 70d9 f164                      ..x$p..d





                                                                                                                                                              share|improve this answer























                                                                                                                                                              • ýñx$pÙñd gives 8 by removing the need to H tio.run/##K/v///DewxsrVAoOzzy8MeX/f6/8jDwA
                                                                                                                                                                – Cows quack
                                                                                                                                                                Dec 9 at 19:43










                                                                                                                                                              • @Cowsquack Even better: ý<M-->ñx$pÙ
                                                                                                                                                                – DJMcMayhem
                                                                                                                                                                Dec 9 at 20:54










                                                                                                                                                              • Doesn't that repeat the last line?
                                                                                                                                                                – Cows quack
                                                                                                                                                                Dec 10 at 6:18













                                                                                                                                                              up vote
                                                                                                                                                              1
                                                                                                                                                              down vote










                                                                                                                                                              up vote
                                                                                                                                                              1
                                                                                                                                                              down vote










                                                                                                                                                              V, 8 bytes



                                                                                                                                                              ýñx$pÙñd


                                                                                                                                                              Try it online!



                                                                                                                                                              Hexdump:



                                                                                                                                                              00000000: fdf1 7824 70d9 f164                      ..x$p..d





                                                                                                                                                              share|improve this answer















                                                                                                                                                              V, 8 bytes



                                                                                                                                                              ýñx$pÙñd


                                                                                                                                                              Try it online!



                                                                                                                                                              Hexdump:



                                                                                                                                                              00000000: fdf1 7824 70d9 f164                      ..x$p..d






                                                                                                                                                              share|improve this answer














                                                                                                                                                              share|improve this answer



                                                                                                                                                              share|improve this answer








                                                                                                                                                              edited Dec 10 at 7:35

























                                                                                                                                                              answered Dec 8 at 22:21









                                                                                                                                                              DJMcMayhem

                                                                                                                                                              40.7k11145308




                                                                                                                                                              40.7k11145308












                                                                                                                                                              • ýñx$pÙñd gives 8 by removing the need to H tio.run/##K/v///DewxsrVAoOzzy8MeX/f6/8jDwA
                                                                                                                                                                – Cows quack
                                                                                                                                                                Dec 9 at 19:43










                                                                                                                                                              • @Cowsquack Even better: ý<M-->ñx$pÙ
                                                                                                                                                                – DJMcMayhem
                                                                                                                                                                Dec 9 at 20:54










                                                                                                                                                              • Doesn't that repeat the last line?
                                                                                                                                                                – Cows quack
                                                                                                                                                                Dec 10 at 6:18


















                                                                                                                                                              • ýñx$pÙñd gives 8 by removing the need to H tio.run/##K/v///DewxsrVAoOzzy8MeX/f6/8jDwA
                                                                                                                                                                – Cows quack
                                                                                                                                                                Dec 9 at 19:43










                                                                                                                                                              • @Cowsquack Even better: ý<M-->ñx$pÙ
                                                                                                                                                                – DJMcMayhem
                                                                                                                                                                Dec 9 at 20:54










                                                                                                                                                              • Doesn't that repeat the last line?
                                                                                                                                                                – Cows quack
                                                                                                                                                                Dec 10 at 6:18
















                                                                                                                                                              ýñx$pÙñd gives 8 by removing the need to H tio.run/##K/v///DewxsrVAoOzzy8MeX/f6/8jDwA
                                                                                                                                                              – Cows quack
                                                                                                                                                              Dec 9 at 19:43




                                                                                                                                                              ýñx$pÙñd gives 8 by removing the need to H tio.run/##K/v///DewxsrVAoOzzy8MeX/f6/8jDwA
                                                                                                                                                              – Cows quack
                                                                                                                                                              Dec 9 at 19:43












                                                                                                                                                              @Cowsquack Even better: ý<M-->ñx$pÙ
                                                                                                                                                              – DJMcMayhem
                                                                                                                                                              Dec 9 at 20:54




                                                                                                                                                              @Cowsquack Even better: ý<M-->ñx$pÙ
                                                                                                                                                              – DJMcMayhem
                                                                                                                                                              Dec 9 at 20:54












                                                                                                                                                              Doesn't that repeat the last line?
                                                                                                                                                              – Cows quack
                                                                                                                                                              Dec 10 at 6:18




                                                                                                                                                              Doesn't that repeat the last line?
                                                                                                                                                              – Cows quack
                                                                                                                                                              Dec 10 at 6:18










                                                                                                                                                              up vote
                                                                                                                                                              1
                                                                                                                                                              down vote














                                                                                                                                                              Tcl, 80 91 bytes



                                                                                                                                                              proc P s {time {puts [set s [string ra $s 1 e][string in $s 0]]} [string le $s]}


                                                                                                                                                              Try it online!






                                                                                                                                                              share|improve this answer























                                                                                                                                                              • Reassign text at each time saves some bytes proc R t {time {puts [set t [string ra $t 1 end][string in $t 0]]} [string len $t]}
                                                                                                                                                                – david
                                                                                                                                                                Dec 9 at 18:05










                                                                                                                                                              • Got it down to 80 bytes, thanks to @david
                                                                                                                                                                – sergiol
                                                                                                                                                                Dec 10 at 10:54















                                                                                                                                                              up vote
                                                                                                                                                              1
                                                                                                                                                              down vote














                                                                                                                                                              Tcl, 80 91 bytes



                                                                                                                                                              proc P s {time {puts [set s [string ra $s 1 e][string in $s 0]]} [string le $s]}


                                                                                                                                                              Try it online!






                                                                                                                                                              share|improve this answer























                                                                                                                                                              • Reassign text at each time saves some bytes proc R t {time {puts [set t [string ra $t 1 end][string in $t 0]]} [string len $t]}
                                                                                                                                                                – david
                                                                                                                                                                Dec 9 at 18:05










                                                                                                                                                              • Got it down to 80 bytes, thanks to @david
                                                                                                                                                                – sergiol
                                                                                                                                                                Dec 10 at 10:54













                                                                                                                                                              up vote
                                                                                                                                                              1
                                                                                                                                                              down vote










                                                                                                                                                              up vote
                                                                                                                                                              1
                                                                                                                                                              down vote










                                                                                                                                                              Tcl, 80 91 bytes



                                                                                                                                                              proc P s {time {puts [set s [string ra $s 1 e][string in $s 0]]} [string le $s]}


                                                                                                                                                              Try it online!






                                                                                                                                                              share|improve this answer















                                                                                                                                                              Tcl, 80 91 bytes



                                                                                                                                                              proc P s {time {puts [set s [string ra $s 1 e][string in $s 0]]} [string le $s]}


                                                                                                                                                              Try it online!







                                                                                                                                                              share|improve this answer














                                                                                                                                                              share|improve this answer



                                                                                                                                                              share|improve this answer








                                                                                                                                                              edited Dec 10 at 10:54

























                                                                                                                                                              answered Dec 8 at 23:50









                                                                                                                                                              sergiol

                                                                                                                                                              2,3621925




                                                                                                                                                              2,3621925












                                                                                                                                                              • Reassign text at each time saves some bytes proc R t {time {puts [set t [string ra $t 1 end][string in $t 0]]} [string len $t]}
                                                                                                                                                                – david
                                                                                                                                                                Dec 9 at 18:05










                                                                                                                                                              • Got it down to 80 bytes, thanks to @david
                                                                                                                                                                – sergiol
                                                                                                                                                                Dec 10 at 10:54


















                                                                                                                                                              • Reassign text at each time saves some bytes proc R t {time {puts [set t [string ra $t 1 end][string in $t 0]]} [string len $t]}
                                                                                                                                                                – david
                                                                                                                                                                Dec 9 at 18:05










                                                                                                                                                              • Got it down to 80 bytes, thanks to @david
                                                                                                                                                                – sergiol
                                                                                                                                                                Dec 10 at 10:54
















                                                                                                                                                              Reassign text at each time saves some bytes proc R t {time {puts [set t [string ra $t 1 end][string in $t 0]]} [string len $t]}
                                                                                                                                                              – david
                                                                                                                                                              Dec 9 at 18:05




                                                                                                                                                              Reassign text at each time saves some bytes proc R t {time {puts [set t [string ra $t 1 end][string in $t 0]]} [string len $t]}
                                                                                                                                                              – david
                                                                                                                                                              Dec 9 at 18:05












                                                                                                                                                              Got it down to 80 bytes, thanks to @david
                                                                                                                                                              – sergiol
                                                                                                                                                              Dec 10 at 10:54




                                                                                                                                                              Got it down to 80 bytes, thanks to @david
                                                                                                                                                              – sergiol
                                                                                                                                                              Dec 10 at 10:54










                                                                                                                                                              up vote
                                                                                                                                                              1
                                                                                                                                                              down vote













                                                                                                                                                              C (32-bit), 58 51 bytes





                                                                                                                                                              i;f(s){for(i=0;i++<printf("%s%.*sn",s+i,i,s)-2;);}


                                                                                                                                                              Try it online!



                                                                                                                                                              Degolf



                                                                                                                                                              i;           // "Global" i.
                                                                                                                                                              f(s){ // s is pointer to string, which conveniently fits in a 32 bit integer.
                                                                                                                                                              for(i=0; // Initialize i.
                                                                                                                                                              // Post-increment i, compare to return value of printf,
                                                                                                                                                              // which just happens to be the number of chars printed, i.e.
                                                                                                                                                              // the length of string s plus 1. Because the printf() is
                                                                                                                                                              // evaluated before the comparison, we need to deduct 2 instead
                                                                                                                                                              // of 1 from the return value.
                                                                                                                                                              i++ < printf("%s%.*sn",s+i,i,s);)-2;
                                                                                                                                                              // The printf prints two strings: first until the terminating ,
                                                                                                                                                              // the second until a or until i chars have been printed.
                                                                                                                                                              }





                                                                                                                                                              share|improve this answer



























                                                                                                                                                                up vote
                                                                                                                                                                1
                                                                                                                                                                down vote













                                                                                                                                                                C (32-bit), 58 51 bytes





                                                                                                                                                                i;f(s){for(i=0;i++<printf("%s%.*sn",s+i,i,s)-2;);}


                                                                                                                                                                Try it online!



                                                                                                                                                                Degolf



                                                                                                                                                                i;           // "Global" i.
                                                                                                                                                                f(s){ // s is pointer to string, which conveniently fits in a 32 bit integer.
                                                                                                                                                                for(i=0; // Initialize i.
                                                                                                                                                                // Post-increment i, compare to return value of printf,
                                                                                                                                                                // which just happens to be the number of chars printed, i.e.
                                                                                                                                                                // the length of string s plus 1. Because the printf() is
                                                                                                                                                                // evaluated before the comparison, we need to deduct 2 instead
                                                                                                                                                                // of 1 from the return value.
                                                                                                                                                                i++ < printf("%s%.*sn",s+i,i,s);)-2;
                                                                                                                                                                // The printf prints two strings: first until the terminating ,
                                                                                                                                                                // the second until a or until i chars have been printed.
                                                                                                                                                                }





                                                                                                                                                                share|improve this answer

























                                                                                                                                                                  up vote
                                                                                                                                                                  1
                                                                                                                                                                  down vote










                                                                                                                                                                  up vote
                                                                                                                                                                  1
                                                                                                                                                                  down vote









                                                                                                                                                                  C (32-bit), 58 51 bytes





                                                                                                                                                                  i;f(s){for(i=0;i++<printf("%s%.*sn",s+i,i,s)-2;);}


                                                                                                                                                                  Try it online!



                                                                                                                                                                  Degolf



                                                                                                                                                                  i;           // "Global" i.
                                                                                                                                                                  f(s){ // s is pointer to string, which conveniently fits in a 32 bit integer.
                                                                                                                                                                  for(i=0; // Initialize i.
                                                                                                                                                                  // Post-increment i, compare to return value of printf,
                                                                                                                                                                  // which just happens to be the number of chars printed, i.e.
                                                                                                                                                                  // the length of string s plus 1. Because the printf() is
                                                                                                                                                                  // evaluated before the comparison, we need to deduct 2 instead
                                                                                                                                                                  // of 1 from the return value.
                                                                                                                                                                  i++ < printf("%s%.*sn",s+i,i,s);)-2;
                                                                                                                                                                  // The printf prints two strings: first until the terminating ,
                                                                                                                                                                  // the second until a or until i chars have been printed.
                                                                                                                                                                  }





                                                                                                                                                                  share|improve this answer














                                                                                                                                                                  C (32-bit), 58 51 bytes





                                                                                                                                                                  i;f(s){for(i=0;i++<printf("%s%.*sn",s+i,i,s)-2;);}


                                                                                                                                                                  Try it online!



                                                                                                                                                                  Degolf



                                                                                                                                                                  i;           // "Global" i.
                                                                                                                                                                  f(s){ // s is pointer to string, which conveniently fits in a 32 bit integer.
                                                                                                                                                                  for(i=0; // Initialize i.
                                                                                                                                                                  // Post-increment i, compare to return value of printf,
                                                                                                                                                                  // which just happens to be the number of chars printed, i.e.
                                                                                                                                                                  // the length of string s plus 1. Because the printf() is
                                                                                                                                                                  // evaluated before the comparison, we need to deduct 2 instead
                                                                                                                                                                  // of 1 from the return value.
                                                                                                                                                                  i++ < printf("%s%.*sn",s+i,i,s);)-2;
                                                                                                                                                                  // The printf prints two strings: first until the terminating ,
                                                                                                                                                                  // the second until a or until i chars have been printed.
                                                                                                                                                                  }






                                                                                                                                                                  share|improve this answer














                                                                                                                                                                  share|improve this answer



                                                                                                                                                                  share|improve this answer








                                                                                                                                                                  edited 2 days ago

























                                                                                                                                                                  answered Dec 9 at 18:47









                                                                                                                                                                  Rogem

                                                                                                                                                                  68312




                                                                                                                                                                  68312






















                                                                                                                                                                      up vote
                                                                                                                                                                      1
                                                                                                                                                                      down vote














                                                                                                                                                                      Ruby, 39 bytes





                                                                                                                                                                      ->s{a=s.chars.to_a;a.map{a.rotate!*''}}


                                                                                                                                                                      Try it online!






                                                                                                                                                                      share|improve this answer










                                                                                                                                                                      New contributor




                                                                                                                                                                      acornellier is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                                                                                                      Check out our Code of Conduct.














                                                                                                                                                                      • 1




                                                                                                                                                                        Welcome to the site! It doesn't look like your TIO link corresponds to your answer. It also seems your answer doesn't fit with our input/output requirements. You can use either a function or STDIN/STDOUT but we don't allow variable reassignment.
                                                                                                                                                                        – Post Left Garf Hunter
                                                                                                                                                                        Dec 11 at 5:10










                                                                                                                                                                      • Thanks Garf. Not sure how I managed to mess both of those up. Should be all good now.
                                                                                                                                                                        – acornellier
                                                                                                                                                                        2 days ago















                                                                                                                                                                      up vote
                                                                                                                                                                      1
                                                                                                                                                                      down vote














                                                                                                                                                                      Ruby, 39 bytes





                                                                                                                                                                      ->s{a=s.chars.to_a;a.map{a.rotate!*''}}


                                                                                                                                                                      Try it online!






                                                                                                                                                                      share|improve this answer










                                                                                                                                                                      New contributor




                                                                                                                                                                      acornellier is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                                                                                                      Check out our Code of Conduct.














                                                                                                                                                                      • 1




                                                                                                                                                                        Welcome to the site! It doesn't look like your TIO link corresponds to your answer. It also seems your answer doesn't fit with our input/output requirements. You can use either a function or STDIN/STDOUT but we don't allow variable reassignment.
                                                                                                                                                                        – Post Left Garf Hunter
                                                                                                                                                                        Dec 11 at 5:10










                                                                                                                                                                      • Thanks Garf. Not sure how I managed to mess both of those up. Should be all good now.
                                                                                                                                                                        – acornellier
                                                                                                                                                                        2 days ago













                                                                                                                                                                      up vote
                                                                                                                                                                      1
                                                                                                                                                                      down vote










                                                                                                                                                                      up vote
                                                                                                                                                                      1
                                                                                                                                                                      down vote










                                                                                                                                                                      Ruby, 39 bytes





                                                                                                                                                                      ->s{a=s.chars.to_a;a.map{a.rotate!*''}}


                                                                                                                                                                      Try it online!






                                                                                                                                                                      share|improve this answer










                                                                                                                                                                      New contributor




                                                                                                                                                                      acornellier is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                                                                                                      Check out our Code of Conduct.










                                                                                                                                                                      Ruby, 39 bytes





                                                                                                                                                                      ->s{a=s.chars.to_a;a.map{a.rotate!*''}}


                                                                                                                                                                      Try it online!







                                                                                                                                                                      share|improve this answer










                                                                                                                                                                      New contributor




                                                                                                                                                                      acornellier is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                                                                                                      Check out our Code of Conduct.









                                                                                                                                                                      share|improve this answer



                                                                                                                                                                      share|improve this answer








                                                                                                                                                                      edited 2 days ago





















                                                                                                                                                                      New contributor




                                                                                                                                                                      acornellier is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                                                                                                      Check out our Code of Conduct.









                                                                                                                                                                      answered Dec 11 at 4:57









                                                                                                                                                                      acornellier

                                                                                                                                                                      112




                                                                                                                                                                      112




                                                                                                                                                                      New contributor




                                                                                                                                                                      acornellier is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                                                                                                      Check out our Code of Conduct.





                                                                                                                                                                      New contributor





                                                                                                                                                                      acornellier is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                                                                                                      Check out our Code of Conduct.






                                                                                                                                                                      acornellier is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                                                                                                      Check out our Code of Conduct.








                                                                                                                                                                      • 1




                                                                                                                                                                        Welcome to the site! It doesn't look like your TIO link corresponds to your answer. It also seems your answer doesn't fit with our input/output requirements. You can use either a function or STDIN/STDOUT but we don't allow variable reassignment.
                                                                                                                                                                        – Post Left Garf Hunter
                                                                                                                                                                        Dec 11 at 5:10










                                                                                                                                                                      • Thanks Garf. Not sure how I managed to mess both of those up. Should be all good now.
                                                                                                                                                                        – acornellier
                                                                                                                                                                        2 days ago














                                                                                                                                                                      • 1




                                                                                                                                                                        Welcome to the site! It doesn't look like your TIO link corresponds to your answer. It also seems your answer doesn't fit with our input/output requirements. You can use either a function or STDIN/STDOUT but we don't allow variable reassignment.
                                                                                                                                                                        – Post Left Garf Hunter
                                                                                                                                                                        Dec 11 at 5:10










                                                                                                                                                                      • Thanks Garf. Not sure how I managed to mess both of those up. Should be all good now.
                                                                                                                                                                        – acornellier
                                                                                                                                                                        2 days ago








                                                                                                                                                                      1




                                                                                                                                                                      1




                                                                                                                                                                      Welcome to the site! It doesn't look like your TIO link corresponds to your answer. It also seems your answer doesn't fit with our input/output requirements. You can use either a function or STDIN/STDOUT but we don't allow variable reassignment.
                                                                                                                                                                      – Post Left Garf Hunter
                                                                                                                                                                      Dec 11 at 5:10




                                                                                                                                                                      Welcome to the site! It doesn't look like your TIO link corresponds to your answer. It also seems your answer doesn't fit with our input/output requirements. You can use either a function or STDIN/STDOUT but we don't allow variable reassignment.
                                                                                                                                                                      – Post Left Garf Hunter
                                                                                                                                                                      Dec 11 at 5:10












                                                                                                                                                                      Thanks Garf. Not sure how I managed to mess both of those up. Should be all good now.
                                                                                                                                                                      – acornellier
                                                                                                                                                                      2 days ago




                                                                                                                                                                      Thanks Garf. Not sure how I managed to mess both of those up. Should be all good now.
                                                                                                                                                                      – acornellier
                                                                                                                                                                      2 days ago










                                                                                                                                                                      up vote
                                                                                                                                                                      0
                                                                                                                                                                      down vote














                                                                                                                                                                      Pyth, 11 bytes



                                                                                                                                                                      VSlQ+>QN<QN


                                                                                                                                                                      Try it online!



                                                                                                                                                                      Pretty much just a port of my Python answer



                                                                                                                                                                      Explanation



                                                                                                                                                                      ==================================================
                                                                                                                                                                      assign('Q',eval_input())
                                                                                                                                                                      for N in num_to_range(Psorted(Plen(Q))):
                                                                                                                                                                      imp_print(plus(gt(Q,N),lt(Q,N)))
                                                                                                                                                                      ==================================================

                                                                                                                                                                      V # for N in
                                                                                                                                                                      S # 1-indexed range
                                                                                                                                                                      lQ # length of evaluated input
                                                                                                                                                                      + # concatanate
                                                                                                                                                                      >QN # all characters after index N in Q (Q[N:])
                                                                                                                                                                      <QN # and all characters before index N in Q (Q[:N])





                                                                                                                                                                      share|improve this answer



























                                                                                                                                                                        up vote
                                                                                                                                                                        0
                                                                                                                                                                        down vote














                                                                                                                                                                        Pyth, 11 bytes



                                                                                                                                                                        VSlQ+>QN<QN


                                                                                                                                                                        Try it online!



                                                                                                                                                                        Pretty much just a port of my Python answer



                                                                                                                                                                        Explanation



                                                                                                                                                                        ==================================================
                                                                                                                                                                        assign('Q',eval_input())
                                                                                                                                                                        for N in num_to_range(Psorted(Plen(Q))):
                                                                                                                                                                        imp_print(plus(gt(Q,N),lt(Q,N)))
                                                                                                                                                                        ==================================================

                                                                                                                                                                        V # for N in
                                                                                                                                                                        S # 1-indexed range
                                                                                                                                                                        lQ # length of evaluated input
                                                                                                                                                                        + # concatanate
                                                                                                                                                                        >QN # all characters after index N in Q (Q[N:])
                                                                                                                                                                        <QN # and all characters before index N in Q (Q[:N])





                                                                                                                                                                        share|improve this answer

























                                                                                                                                                                          up vote
                                                                                                                                                                          0
                                                                                                                                                                          down vote










                                                                                                                                                                          up vote
                                                                                                                                                                          0
                                                                                                                                                                          down vote










                                                                                                                                                                          Pyth, 11 bytes



                                                                                                                                                                          VSlQ+>QN<QN


                                                                                                                                                                          Try it online!



                                                                                                                                                                          Pretty much just a port of my Python answer



                                                                                                                                                                          Explanation



                                                                                                                                                                          ==================================================
                                                                                                                                                                          assign('Q',eval_input())
                                                                                                                                                                          for N in num_to_range(Psorted(Plen(Q))):
                                                                                                                                                                          imp_print(plus(gt(Q,N),lt(Q,N)))
                                                                                                                                                                          ==================================================

                                                                                                                                                                          V # for N in
                                                                                                                                                                          S # 1-indexed range
                                                                                                                                                                          lQ # length of evaluated input
                                                                                                                                                                          + # concatanate
                                                                                                                                                                          >QN # all characters after index N in Q (Q[N:])
                                                                                                                                                                          <QN # and all characters before index N in Q (Q[:N])





                                                                                                                                                                          share|improve this answer















                                                                                                                                                                          Pyth, 11 bytes



                                                                                                                                                                          VSlQ+>QN<QN


                                                                                                                                                                          Try it online!



                                                                                                                                                                          Pretty much just a port of my Python answer



                                                                                                                                                                          Explanation



                                                                                                                                                                          ==================================================
                                                                                                                                                                          assign('Q',eval_input())
                                                                                                                                                                          for N in num_to_range(Psorted(Plen(Q))):
                                                                                                                                                                          imp_print(plus(gt(Q,N),lt(Q,N)))
                                                                                                                                                                          ==================================================

                                                                                                                                                                          V # for N in
                                                                                                                                                                          S # 1-indexed range
                                                                                                                                                                          lQ # length of evaluated input
                                                                                                                                                                          + # concatanate
                                                                                                                                                                          >QN # all characters after index N in Q (Q[N:])
                                                                                                                                                                          <QN # and all characters before index N in Q (Q[:N])






                                                                                                                                                                          share|improve this answer














                                                                                                                                                                          share|improve this answer



                                                                                                                                                                          share|improve this answer








                                                                                                                                                                          edited Dec 9 at 18:10

























                                                                                                                                                                          answered Dec 9 at 13:36









                                                                                                                                                                          ElPedro

                                                                                                                                                                          3,4631023




                                                                                                                                                                          3,4631023






















                                                                                                                                                                              up vote
                                                                                                                                                                              0
                                                                                                                                                                              down vote














                                                                                                                                                                              Tcl, 78 bytes



                                                                                                                                                                              proc R t {time {puts [set t [regsub -all (.?)(.*) $t {21}]]} [string le $t]}


                                                                                                                                                                              Try it online!






                                                                                                                                                                              share|improve this answer

























                                                                                                                                                                                up vote
                                                                                                                                                                                0
                                                                                                                                                                                down vote














                                                                                                                                                                                Tcl, 78 bytes



                                                                                                                                                                                proc R t {time {puts [set t [regsub -all (.?)(.*) $t {21}]]} [string le $t]}


                                                                                                                                                                                Try it online!






                                                                                                                                                                                share|improve this answer























                                                                                                                                                                                  up vote
                                                                                                                                                                                  0
                                                                                                                                                                                  down vote










                                                                                                                                                                                  up vote
                                                                                                                                                                                  0
                                                                                                                                                                                  down vote










                                                                                                                                                                                  Tcl, 78 bytes



                                                                                                                                                                                  proc R t {time {puts [set t [regsub -all (.?)(.*) $t {21}]]} [string le $t]}


                                                                                                                                                                                  Try it online!






                                                                                                                                                                                  share|improve this answer













                                                                                                                                                                                  Tcl, 78 bytes



                                                                                                                                                                                  proc R t {time {puts [set t [regsub -all (.?)(.*) $t {21}]]} [string le $t]}


                                                                                                                                                                                  Try it online!







                                                                                                                                                                                  share|improve this answer












                                                                                                                                                                                  share|improve this answer



                                                                                                                                                                                  share|improve this answer










                                                                                                                                                                                  answered Dec 9 at 18:38









                                                                                                                                                                                  david

                                                                                                                                                                                  6418




                                                                                                                                                                                  6418






















                                                                                                                                                                                      up vote
                                                                                                                                                                                      0
                                                                                                                                                                                      down vote














                                                                                                                                                                                      Pushy, 4 bytes



                                                                                                                                                                                      L:{"


                                                                                                                                                                                      Try it online!



                                                                                                                                                                                      L:     Length of the string times do:
                                                                                                                                                                                      { Cyclically shift left once
                                                                                                                                                                                      " Print





                                                                                                                                                                                      share|improve this answer

























                                                                                                                                                                                        up vote
                                                                                                                                                                                        0
                                                                                                                                                                                        down vote














                                                                                                                                                                                        Pushy, 4 bytes



                                                                                                                                                                                        L:{"


                                                                                                                                                                                        Try it online!



                                                                                                                                                                                        L:     Length of the string times do:
                                                                                                                                                                                        { Cyclically shift left once
                                                                                                                                                                                        " Print





                                                                                                                                                                                        share|improve this answer























                                                                                                                                                                                          up vote
                                                                                                                                                                                          0
                                                                                                                                                                                          down vote










                                                                                                                                                                                          up vote
                                                                                                                                                                                          0
                                                                                                                                                                                          down vote










                                                                                                                                                                                          Pushy, 4 bytes



                                                                                                                                                                                          L:{"


                                                                                                                                                                                          Try it online!



                                                                                                                                                                                          L:     Length of the string times do:
                                                                                                                                                                                          { Cyclically shift left once
                                                                                                                                                                                          " Print





                                                                                                                                                                                          share|improve this answer













                                                                                                                                                                                          Pushy, 4 bytes



                                                                                                                                                                                          L:{"


                                                                                                                                                                                          Try it online!



                                                                                                                                                                                          L:     Length of the string times do:
                                                                                                                                                                                          { Cyclically shift left once
                                                                                                                                                                                          " Print






                                                                                                                                                                                          share|improve this answer












                                                                                                                                                                                          share|improve this answer



                                                                                                                                                                                          share|improve this answer










                                                                                                                                                                                          answered Dec 9 at 21:57









                                                                                                                                                                                          FlipTack

                                                                                                                                                                                          9,05834089




                                                                                                                                                                                          9,05834089






















                                                                                                                                                                                              up vote
                                                                                                                                                                                              0
                                                                                                                                                                                              down vote














                                                                                                                                                                                              Perl 6, 20 bytes





                                                                                                                                                                                              {.rotate(all 1..$_)}


                                                                                                                                                                                              Try it online!



                                                                                                                                                                                              Anonymous code block that has input/output as a list of characters. The output is a Junction object that contains all the rotated arrays. I'm not sure how legal this is, since extracting values from a Junction is not normal.



                                                                                                                                                                                              Explanation:



                                                                                                                                                                                              {                  }   # Anonymous codeblock
                                                                                                                                                                                              .rotate( ) # Rotate the input list
                                                                                                                                                                                              all 1..$_ # By all of the range 1 to length of the input array
                                                                                                                                                                                              # all creates a junction of values
                                                                                                                                                                                              # And it runs the function on each value


                                                                                                                                                                                              The all can be replaced by any of any, one, [&], [|], [^].



                                                                                                                                                                                              If the Junction isn't allowed, here's an alternate solution for 22 bytes:





                                                                                                                                                                                              {.&{.rotate(++$)xx$_}}


                                                                                                                                                                                              Try it online!



                                                                                                                                                                                              There's probably a better way to reset the anonymous variable ++$ than by wrapping the code in another code block...






                                                                                                                                                                                              share|improve this answer

























                                                                                                                                                                                                up vote
                                                                                                                                                                                                0
                                                                                                                                                                                                down vote














                                                                                                                                                                                                Perl 6, 20 bytes





                                                                                                                                                                                                {.rotate(all 1..$_)}


                                                                                                                                                                                                Try it online!



                                                                                                                                                                                                Anonymous code block that has input/output as a list of characters. The output is a Junction object that contains all the rotated arrays. I'm not sure how legal this is, since extracting values from a Junction is not normal.



                                                                                                                                                                                                Explanation:



                                                                                                                                                                                                {                  }   # Anonymous codeblock
                                                                                                                                                                                                .rotate( ) # Rotate the input list
                                                                                                                                                                                                all 1..$_ # By all of the range 1 to length of the input array
                                                                                                                                                                                                # all creates a junction of values
                                                                                                                                                                                                # And it runs the function on each value


                                                                                                                                                                                                The all can be replaced by any of any, one, [&], [|], [^].



                                                                                                                                                                                                If the Junction isn't allowed, here's an alternate solution for 22 bytes:





                                                                                                                                                                                                {.&{.rotate(++$)xx$_}}


                                                                                                                                                                                                Try it online!



                                                                                                                                                                                                There's probably a better way to reset the anonymous variable ++$ than by wrapping the code in another code block...






                                                                                                                                                                                                share|improve this answer























                                                                                                                                                                                                  up vote
                                                                                                                                                                                                  0
                                                                                                                                                                                                  down vote










                                                                                                                                                                                                  up vote
                                                                                                                                                                                                  0
                                                                                                                                                                                                  down vote










                                                                                                                                                                                                  Perl 6, 20 bytes





                                                                                                                                                                                                  {.rotate(all 1..$_)}


                                                                                                                                                                                                  Try it online!



                                                                                                                                                                                                  Anonymous code block that has input/output as a list of characters. The output is a Junction object that contains all the rotated arrays. I'm not sure how legal this is, since extracting values from a Junction is not normal.



                                                                                                                                                                                                  Explanation:



                                                                                                                                                                                                  {                  }   # Anonymous codeblock
                                                                                                                                                                                                  .rotate( ) # Rotate the input list
                                                                                                                                                                                                  all 1..$_ # By all of the range 1 to length of the input array
                                                                                                                                                                                                  # all creates a junction of values
                                                                                                                                                                                                  # And it runs the function on each value


                                                                                                                                                                                                  The all can be replaced by any of any, one, [&], [|], [^].



                                                                                                                                                                                                  If the Junction isn't allowed, here's an alternate solution for 22 bytes:





                                                                                                                                                                                                  {.&{.rotate(++$)xx$_}}


                                                                                                                                                                                                  Try it online!



                                                                                                                                                                                                  There's probably a better way to reset the anonymous variable ++$ than by wrapping the code in another code block...






                                                                                                                                                                                                  share|improve this answer













                                                                                                                                                                                                  Perl 6, 20 bytes





                                                                                                                                                                                                  {.rotate(all 1..$_)}


                                                                                                                                                                                                  Try it online!



                                                                                                                                                                                                  Anonymous code block that has input/output as a list of characters. The output is a Junction object that contains all the rotated arrays. I'm not sure how legal this is, since extracting values from a Junction is not normal.



                                                                                                                                                                                                  Explanation:



                                                                                                                                                                                                  {                  }   # Anonymous codeblock
                                                                                                                                                                                                  .rotate( ) # Rotate the input list
                                                                                                                                                                                                  all 1..$_ # By all of the range 1 to length of the input array
                                                                                                                                                                                                  # all creates a junction of values
                                                                                                                                                                                                  # And it runs the function on each value


                                                                                                                                                                                                  The all can be replaced by any of any, one, [&], [|], [^].



                                                                                                                                                                                                  If the Junction isn't allowed, here's an alternate solution for 22 bytes:





                                                                                                                                                                                                  {.&{.rotate(++$)xx$_}}


                                                                                                                                                                                                  Try it online!



                                                                                                                                                                                                  There's probably a better way to reset the anonymous variable ++$ than by wrapping the code in another code block...







                                                                                                                                                                                                  share|improve this answer












                                                                                                                                                                                                  share|improve this answer



                                                                                                                                                                                                  share|improve this answer










                                                                                                                                                                                                  answered Dec 9 at 22:56









                                                                                                                                                                                                  Jo King

                                                                                                                                                                                                  20.4k246108




                                                                                                                                                                                                  20.4k246108






















                                                                                                                                                                                                      up vote
                                                                                                                                                                                                      0
                                                                                                                                                                                                      down vote













                                                                                                                                                                                                      JavaScript, 48 43 bytes



                                                                                                                                                                                                      -5 bytes courtesy of @Bubbler



                                                                                                                                                                                                      s=>[...s].map(_=>([a,...b]=s,s=b.join``+a))


                                                                                                                                                                                                      Try it online!






                                                                                                                                                                                                      share|improve this answer



















                                                                                                                                                                                                      • 1




                                                                                                                                                                                                        43 bytes.
                                                                                                                                                                                                        – Bubbler
                                                                                                                                                                                                        Dec 10 at 1:54

















                                                                                                                                                                                                      up vote
                                                                                                                                                                                                      0
                                                                                                                                                                                                      down vote













                                                                                                                                                                                                      JavaScript, 48 43 bytes



                                                                                                                                                                                                      -5 bytes courtesy of @Bubbler



                                                                                                                                                                                                      s=>[...s].map(_=>([a,...b]=s,s=b.join``+a))


                                                                                                                                                                                                      Try it online!






                                                                                                                                                                                                      share|improve this answer



















                                                                                                                                                                                                      • 1




                                                                                                                                                                                                        43 bytes.
                                                                                                                                                                                                        – Bubbler
                                                                                                                                                                                                        Dec 10 at 1:54















                                                                                                                                                                                                      up vote
                                                                                                                                                                                                      0
                                                                                                                                                                                                      down vote










                                                                                                                                                                                                      up vote
                                                                                                                                                                                                      0
                                                                                                                                                                                                      down vote









                                                                                                                                                                                                      JavaScript, 48 43 bytes



                                                                                                                                                                                                      -5 bytes courtesy of @Bubbler



                                                                                                                                                                                                      s=>[...s].map(_=>([a,...b]=s,s=b.join``+a))


                                                                                                                                                                                                      Try it online!






                                                                                                                                                                                                      share|improve this answer














                                                                                                                                                                                                      JavaScript, 48 43 bytes



                                                                                                                                                                                                      -5 bytes courtesy of @Bubbler



                                                                                                                                                                                                      s=>[...s].map(_=>([a,...b]=s,s=b.join``+a))


                                                                                                                                                                                                      Try it online!







                                                                                                                                                                                                      share|improve this answer














                                                                                                                                                                                                      share|improve this answer



                                                                                                                                                                                                      share|improve this answer








                                                                                                                                                                                                      edited Dec 10 at 1:59

























                                                                                                                                                                                                      answered Dec 10 at 0:58









                                                                                                                                                                                                      guest271314

                                                                                                                                                                                                      317211




                                                                                                                                                                                                      317211








                                                                                                                                                                                                      • 1




                                                                                                                                                                                                        43 bytes.
                                                                                                                                                                                                        – Bubbler
                                                                                                                                                                                                        Dec 10 at 1:54
















                                                                                                                                                                                                      • 1




                                                                                                                                                                                                        43 bytes.
                                                                                                                                                                                                        – Bubbler
                                                                                                                                                                                                        Dec 10 at 1:54










                                                                                                                                                                                                      1




                                                                                                                                                                                                      1




                                                                                                                                                                                                      43 bytes.
                                                                                                                                                                                                      – Bubbler
                                                                                                                                                                                                      Dec 10 at 1:54






                                                                                                                                                                                                      43 bytes.
                                                                                                                                                                                                      – Bubbler
                                                                                                                                                                                                      Dec 10 at 1:54












                                                                                                                                                                                                      up vote
                                                                                                                                                                                                      0
                                                                                                                                                                                                      down vote













                                                                                                                                                                                                      Powershell, 44 bytes





                                                                                                                                                                                                      ($s=$args|% t*y)|%{$h,$t=$s;-join($s=$t+$h)}


                                                                                                                                                                                                      Test script:



                                                                                                                                                                                                      $f = {

                                                                                                                                                                                                      ($s=$args|% t*y)|%{$h,$t=$s;-join($s=$t+$h)}

                                                                                                                                                                                                      }

                                                                                                                                                                                                      @(
                                                                                                                                                                                                      ,('john', 'ohnj', 'hnjo', 'njoh', 'john')
                                                                                                                                                                                                      ,('heehee', 'eeheeh', 'eheehe', 'heehee', 'eeheeh', 'eheehe', 'heehee')
                                                                                                                                                                                                      ) | % {
                                                                                                                                                                                                      $s,$expected = $_
                                                                                                                                                                                                      $result = &$f $s
                                                                                                                                                                                                      "$result"-eq"$expected"
                                                                                                                                                                                                      $result
                                                                                                                                                                                                      }


                                                                                                                                                                                                      output:



                                                                                                                                                                                                      True
                                                                                                                                                                                                      ohnj
                                                                                                                                                                                                      hnjo
                                                                                                                                                                                                      njoh
                                                                                                                                                                                                      john
                                                                                                                                                                                                      True
                                                                                                                                                                                                      eeheeh
                                                                                                                                                                                                      eheehe
                                                                                                                                                                                                      heehee
                                                                                                                                                                                                      eeheeh
                                                                                                                                                                                                      eheehe
                                                                                                                                                                                                      heehee





                                                                                                                                                                                                      share|improve this answer

























                                                                                                                                                                                                        up vote
                                                                                                                                                                                                        0
                                                                                                                                                                                                        down vote













                                                                                                                                                                                                        Powershell, 44 bytes





                                                                                                                                                                                                        ($s=$args|% t*y)|%{$h,$t=$s;-join($s=$t+$h)}


                                                                                                                                                                                                        Test script:



                                                                                                                                                                                                        $f = {

                                                                                                                                                                                                        ($s=$args|% t*y)|%{$h,$t=$s;-join($s=$t+$h)}

                                                                                                                                                                                                        }

                                                                                                                                                                                                        @(
                                                                                                                                                                                                        ,('john', 'ohnj', 'hnjo', 'njoh', 'john')
                                                                                                                                                                                                        ,('heehee', 'eeheeh', 'eheehe', 'heehee', 'eeheeh', 'eheehe', 'heehee')
                                                                                                                                                                                                        ) | % {
                                                                                                                                                                                                        $s,$expected = $_
                                                                                                                                                                                                        $result = &$f $s
                                                                                                                                                                                                        "$result"-eq"$expected"
                                                                                                                                                                                                        $result
                                                                                                                                                                                                        }


                                                                                                                                                                                                        output:



                                                                                                                                                                                                        True
                                                                                                                                                                                                        ohnj
                                                                                                                                                                                                        hnjo
                                                                                                                                                                                                        njoh
                                                                                                                                                                                                        john
                                                                                                                                                                                                        True
                                                                                                                                                                                                        eeheeh
                                                                                                                                                                                                        eheehe
                                                                                                                                                                                                        heehee
                                                                                                                                                                                                        eeheeh
                                                                                                                                                                                                        eheehe
                                                                                                                                                                                                        heehee





                                                                                                                                                                                                        share|improve this answer























                                                                                                                                                                                                          up vote
                                                                                                                                                                                                          0
                                                                                                                                                                                                          down vote










                                                                                                                                                                                                          up vote
                                                                                                                                                                                                          0
                                                                                                                                                                                                          down vote









                                                                                                                                                                                                          Powershell, 44 bytes





                                                                                                                                                                                                          ($s=$args|% t*y)|%{$h,$t=$s;-join($s=$t+$h)}


                                                                                                                                                                                                          Test script:



                                                                                                                                                                                                          $f = {

                                                                                                                                                                                                          ($s=$args|% t*y)|%{$h,$t=$s;-join($s=$t+$h)}

                                                                                                                                                                                                          }

                                                                                                                                                                                                          @(
                                                                                                                                                                                                          ,('john', 'ohnj', 'hnjo', 'njoh', 'john')
                                                                                                                                                                                                          ,('heehee', 'eeheeh', 'eheehe', 'heehee', 'eeheeh', 'eheehe', 'heehee')
                                                                                                                                                                                                          ) | % {
                                                                                                                                                                                                          $s,$expected = $_
                                                                                                                                                                                                          $result = &$f $s
                                                                                                                                                                                                          "$result"-eq"$expected"
                                                                                                                                                                                                          $result
                                                                                                                                                                                                          }


                                                                                                                                                                                                          output:



                                                                                                                                                                                                          True
                                                                                                                                                                                                          ohnj
                                                                                                                                                                                                          hnjo
                                                                                                                                                                                                          njoh
                                                                                                                                                                                                          john
                                                                                                                                                                                                          True
                                                                                                                                                                                                          eeheeh
                                                                                                                                                                                                          eheehe
                                                                                                                                                                                                          heehee
                                                                                                                                                                                                          eeheeh
                                                                                                                                                                                                          eheehe
                                                                                                                                                                                                          heehee





                                                                                                                                                                                                          share|improve this answer












                                                                                                                                                                                                          Powershell, 44 bytes





                                                                                                                                                                                                          ($s=$args|% t*y)|%{$h,$t=$s;-join($s=$t+$h)}


                                                                                                                                                                                                          Test script:



                                                                                                                                                                                                          $f = {

                                                                                                                                                                                                          ($s=$args|% t*y)|%{$h,$t=$s;-join($s=$t+$h)}

                                                                                                                                                                                                          }

                                                                                                                                                                                                          @(
                                                                                                                                                                                                          ,('john', 'ohnj', 'hnjo', 'njoh', 'john')
                                                                                                                                                                                                          ,('heehee', 'eeheeh', 'eheehe', 'heehee', 'eeheeh', 'eheehe', 'heehee')
                                                                                                                                                                                                          ) | % {
                                                                                                                                                                                                          $s,$expected = $_
                                                                                                                                                                                                          $result = &$f $s
                                                                                                                                                                                                          "$result"-eq"$expected"
                                                                                                                                                                                                          $result
                                                                                                                                                                                                          }


                                                                                                                                                                                                          output:



                                                                                                                                                                                                          True
                                                                                                                                                                                                          ohnj
                                                                                                                                                                                                          hnjo
                                                                                                                                                                                                          njoh
                                                                                                                                                                                                          john
                                                                                                                                                                                                          True
                                                                                                                                                                                                          eeheeh
                                                                                                                                                                                                          eheehe
                                                                                                                                                                                                          heehee
                                                                                                                                                                                                          eeheeh
                                                                                                                                                                                                          eheehe
                                                                                                                                                                                                          heehee






                                                                                                                                                                                                          share|improve this answer












                                                                                                                                                                                                          share|improve this answer



                                                                                                                                                                                                          share|improve this answer










                                                                                                                                                                                                          answered Dec 10 at 9:08









                                                                                                                                                                                                          mazzy

                                                                                                                                                                                                          2,0151314




                                                                                                                                                                                                          2,0151314






















                                                                                                                                                                                                              up vote
                                                                                                                                                                                                              0
                                                                                                                                                                                                              down vote














                                                                                                                                                                                                              Pepe, 64 bytes



                                                                                                                                                                                                              REEeRREeeeREEEEEREErEEEEErRREEEEEEEREEEeeReReeeReeErRrEEEEEEERee


                                                                                                                                                                                                              Try it online! Uses newlines for separation.






                                                                                                                                                                                                              share|improve this answer

























                                                                                                                                                                                                                up vote
                                                                                                                                                                                                                0
                                                                                                                                                                                                                down vote














                                                                                                                                                                                                                Pepe, 64 bytes



                                                                                                                                                                                                                REEeRREeeeREEEEEREErEEEEErRREEEEEEEREEEeeReReeeReeErRrEEEEEEERee


                                                                                                                                                                                                                Try it online! Uses newlines for separation.






                                                                                                                                                                                                                share|improve this answer























                                                                                                                                                                                                                  up vote
                                                                                                                                                                                                                  0
                                                                                                                                                                                                                  down vote










                                                                                                                                                                                                                  up vote
                                                                                                                                                                                                                  0
                                                                                                                                                                                                                  down vote










                                                                                                                                                                                                                  Pepe, 64 bytes



                                                                                                                                                                                                                  REEeRREeeeREEEEEREErEEEEErRREEEEEEEREEEeeReReeeReeErRrEEEEEEERee


                                                                                                                                                                                                                  Try it online! Uses newlines for separation.






                                                                                                                                                                                                                  share|improve this answer













                                                                                                                                                                                                                  Pepe, 64 bytes



                                                                                                                                                                                                                  REEeRREeeeREEEEEREErEEEEErRREEEEEEEREEEeeReReeeReeErRrEEEEEEERee


                                                                                                                                                                                                                  Try it online! Uses newlines for separation.







                                                                                                                                                                                                                  share|improve this answer












                                                                                                                                                                                                                  share|improve this answer



                                                                                                                                                                                                                  share|improve this answer










                                                                                                                                                                                                                  answered Dec 10 at 11:44









                                                                                                                                                                                                                  u_ndefined

                                                                                                                                                                                                                  654114




                                                                                                                                                                                                                  654114






















                                                                                                                                                                                                                      up vote
                                                                                                                                                                                                                      0
                                                                                                                                                                                                                      down vote














                                                                                                                                                                                                                      Java (JDK), 85 bytes





                                                                                                                                                                                                                      s->{for(int i=s.length();i-->0;)System.out.println(s.substring(i)+s.substring(0,i));}


                                                                                                                                                                                                                      Try it online!






                                                                                                                                                                                                                      share|improve this answer



























                                                                                                                                                                                                                        up vote
                                                                                                                                                                                                                        0
                                                                                                                                                                                                                        down vote














                                                                                                                                                                                                                        Java (JDK), 85 bytes





                                                                                                                                                                                                                        s->{for(int i=s.length();i-->0;)System.out.println(s.substring(i)+s.substring(0,i));}


                                                                                                                                                                                                                        Try it online!






                                                                                                                                                                                                                        share|improve this answer

























                                                                                                                                                                                                                          up vote
                                                                                                                                                                                                                          0
                                                                                                                                                                                                                          down vote










                                                                                                                                                                                                                          up vote
                                                                                                                                                                                                                          0
                                                                                                                                                                                                                          down vote










                                                                                                                                                                                                                          Java (JDK), 85 bytes





                                                                                                                                                                                                                          s->{for(int i=s.length();i-->0;)System.out.println(s.substring(i)+s.substring(0,i));}


                                                                                                                                                                                                                          Try it online!






                                                                                                                                                                                                                          share|improve this answer















                                                                                                                                                                                                                          Java (JDK), 85 bytes





                                                                                                                                                                                                                          s->{for(int i=s.length();i-->0;)System.out.println(s.substring(i)+s.substring(0,i));}


                                                                                                                                                                                                                          Try it online!







                                                                                                                                                                                                                          share|improve this answer














                                                                                                                                                                                                                          share|improve this answer



                                                                                                                                                                                                                          share|improve this answer








                                                                                                                                                                                                                          edited Dec 10 at 16:35

























                                                                                                                                                                                                                          answered Dec 10 at 16:16









                                                                                                                                                                                                                          Olivier Grégoire

                                                                                                                                                                                                                          8,69711843




                                                                                                                                                                                                                          8,69711843






















                                                                                                                                                                                                                              1 2
                                                                                                                                                                                                                              next









                                                                                                                                                                                                                              I_P_Edwards is a new contributor. Be nice, and check out our Code of Conduct.










                                                                                                                                                                                                                              draft saved

                                                                                                                                                                                                                              draft discarded


















                                                                                                                                                                                                                              I_P_Edwards is a new contributor. Be nice, and check out our Code of Conduct.













                                                                                                                                                                                                                              I_P_Edwards is a new contributor. Be nice, and check out our Code of Conduct.












                                                                                                                                                                                                                              I_P_Edwards is a new contributor. Be nice, and check out our Code of Conduct.
















                                                                                                                                                                                                                              If this is an answer to a challenge…




                                                                                                                                                                                                                              • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                                                                                                                                                                                                                              • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                                                                                                                                                                                                                                Explanations of your answer make it more interesting to read and are very much encouraged.


                                                                                                                                                                                                                              • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.



                                                                                                                                                                                                                              More generally…




                                                                                                                                                                                                                              • …Please make sure to answer the question and provide sufficient detail.


                                                                                                                                                                                                                              • …Avoid asking for help, clarification or responding to other answers (use comments instead).






                                                                                                                                                                                                                              Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                                                                                                                                                                                                              Please pay close attention to the following guidance:


                                                                                                                                                                                                                              • Please be sure to answer the question. Provide details and share your research!

                                                                                                                                                                                                                              But avoid



                                                                                                                                                                                                                              • Asking for help, clarification, or responding to other answers.

                                                                                                                                                                                                                              • Making statements based on opinion; back them up with references or personal experience.


                                                                                                                                                                                                                              To learn more, see our tips on writing great answers.




                                                                                                                                                                                                                              draft saved


                                                                                                                                                                                                                              draft discarded














                                                                                                                                                                                                                              StackExchange.ready(
                                                                                                                                                                                                                              function () {
                                                                                                                                                                                                                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f177221%2fstring-rotation-output-string-repeatedly-moving-first-character-to-the-end%23new-answer', 'question_page');
                                                                                                                                                                                                                              }
                                                                                                                                                                                                                              );

                                                                                                                                                                                                                              Post as a guest















                                                                                                                                                                                                                              Required, but never shown





















































                                                                                                                                                                                                                              Required, but never shown














                                                                                                                                                                                                                              Required, but never shown












                                                                                                                                                                                                                              Required, but never shown







                                                                                                                                                                                                                              Required, but never shown

































                                                                                                                                                                                                                              Required, but never shown














                                                                                                                                                                                                                              Required, but never shown












                                                                                                                                                                                                                              Required, but never shown







                                                                                                                                                                                                                              Required, but never shown







                                                                                                                                                                                                                              Popular posts from this blog

                                                                                                                                                                                                                              數位音樂下載

                                                                                                                                                                                                                              When can things happen in Etherscan, such as the picture below?

                                                                                                                                                                                                                              格利澤436b