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












21












$begingroup$


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











$endgroup$








  • 5




    $begingroup$
    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.
    $endgroup$
    – xnor
    Dec 8 '18 at 22:43












  • $begingroup$
    May we cycle in the other direction?
    $endgroup$
    – xnor
    Dec 8 '18 at 22:45






  • 2




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






  • 1




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






  • 1




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
















21












$begingroup$


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











$endgroup$








  • 5




    $begingroup$
    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.
    $endgroup$
    – xnor
    Dec 8 '18 at 22:43












  • $begingroup$
    May we cycle in the other direction?
    $endgroup$
    – xnor
    Dec 8 '18 at 22:45






  • 2




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






  • 1




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






  • 1




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














21












21








21


2



$begingroup$


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











$endgroup$




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















share|improve this question













share|improve this question




share|improve this question








edited Dec 9 '18 at 20:44







I_P_Edwards

















asked Dec 8 '18 at 22:14









I_P_EdwardsI_P_Edwards

1086




1086








  • 5




    $begingroup$
    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.
    $endgroup$
    – xnor
    Dec 8 '18 at 22:43












  • $begingroup$
    May we cycle in the other direction?
    $endgroup$
    – xnor
    Dec 8 '18 at 22:45






  • 2




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






  • 1




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






  • 1




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














  • 5




    $begingroup$
    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.
    $endgroup$
    – xnor
    Dec 8 '18 at 22:43












  • $begingroup$
    May we cycle in the other direction?
    $endgroup$
    – xnor
    Dec 8 '18 at 22:45






  • 2




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






  • 1




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






  • 1




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








5




5




$begingroup$
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.
$endgroup$
– xnor
Dec 8 '18 at 22:43






$begingroup$
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.
$endgroup$
– xnor
Dec 8 '18 at 22:43














$begingroup$
May we cycle in the other direction?
$endgroup$
– xnor
Dec 8 '18 at 22:45




$begingroup$
May we cycle in the other direction?
$endgroup$
– xnor
Dec 8 '18 at 22:45




2




2




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




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




1




1




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




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




1




1




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




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










45 Answers
45






active

oldest

votes













1 2
next












6












$begingroup$


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











$endgroup$





















    8












    $begingroup$

    Haskell, 27 bytes



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


    Try it online!






    share|improve this answer









    $endgroup$





















      6












      $begingroup$


      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









      $endgroup$





















        6












        $begingroup$


        Python 2, 38 bytes





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


        Try it online!






        share|improve this answer









        $endgroup$













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










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










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



















        6












        $begingroup$

        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











        $endgroup$





















          4












          $begingroup$

          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











          $endgroup$





















            3












            $begingroup$


            05AB1E, 3 bytes



            ā._


            Try it online!






            share|improve this answer











            $endgroup$





















              3












              $begingroup$


              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









              $endgroup$





















                3












                $begingroup$


                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











                $endgroup$













                • $begingroup$
                  @LuisMendo Clever! Thanks!
                  $endgroup$
                  – Suever
                  Dec 12 '18 at 10:50



















                3












                $begingroup$


                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











                $endgroup$













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










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





















                2












                $begingroup$


                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









                $endgroup$





















                  2












                  $begingroup$


                  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









                  $endgroup$









                  • 2




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










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





















                  2












                  $begingroup$


                  R, 58 bytes





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


                  Try it online!






                  share|improve this answer









                  $endgroup$





















                    2












                    $begingroup$


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





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


                    Try it online!






                    share|improve this answer











                    $endgroup$





















                      2












                      $begingroup$

                      C (32-bit), 58 51 50 bytes



                      -1 byte for a nice round number thanks to ceilingcat





                      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.
                      // Increment i and take its complement, and add it to the
                      // return value of printf(); which just happens to be strlen(s)+1.
                      // ~i + strlen(s) + 1 == strlen(s) + 1 - i - 1, so the last printed
                      // string is the original string.
                      ~++i + printf("%s%.*sn",s+i,i,s);
                      // The printf prints two strings: first until the terminating ,
                      // the second until a or until i chars have been printed. It also
                      // prints a linefeed.
                      }





                      share|improve this answer











                      $endgroup$













                      • $begingroup$
                        Suggest ~++i+printf("%s%.*sn",s+i,i,s) instead of i++<printf("%s%.*sn",s+i,i,s)-2
                        $endgroup$
                        – ceilingcat
                        Jan 7 at 9:06










                      • $begingroup$
                        @ceilingcat Thanks, as always!
                        $endgroup$
                        – Rogem
                        Jan 8 at 8:54










                      • $begingroup$
                        @ceilingcat You really should be called flooringcat.
                        $endgroup$
                        – Rogem
                        Jan 8 at 8:54



















                      1












                      $begingroup$


                      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









                      $endgroup$





















                        1












                        $begingroup$


                        Red, 49 43 bytes



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


                        Try it online!






                        share|improve this answer











                        $endgroup$





















                          1












                          $begingroup$


                          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











                          $endgroup$





















                            1












                            $begingroup$


                            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









                            $endgroup$





















                              1












                              $begingroup$


                              Pushy, 4 bytes



                              L:{"


                              Try it online!



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





                              share|improve this answer









                              $endgroup$





















                                1












                                $begingroup$


                                V, 8 bytes



                                ýñx$pÙñd


                                Try it online!



                                Hexdump:



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





                                share|improve this answer











                                $endgroup$













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










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










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



















                                1












                                $begingroup$

                                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









                                $endgroup$





















                                  1












                                  $begingroup$


                                  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











                                  $endgroup$













                                  • $begingroup$
                                    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]}
                                    $endgroup$
                                    – david
                                    Dec 9 '18 at 18:05










                                  • $begingroup$
                                    Got it down to 80 bytes, thanks to @david
                                    $endgroup$
                                    – sergiol
                                    Dec 10 '18 at 10:54



















                                  1












                                  $begingroup$


                                  SNOBOL4 (CSNOBOL4), 82 bytes



                                  	S =INPUT
                                  T X =X + 1
                                  S LEN(1) . L REM . R
                                  OUTPUT =S =R L LE(X,SIZE(S)) :S(T)
                                  END


                                  Try it online!






                                  share|improve this answer









                                  $endgroup$





















                                    1












                                    $begingroup$


                                    Ruby, 39 bytes





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


                                    Try it online!






                                    share|improve this answer











                                    $endgroup$









                                    • 1




                                      $begingroup$
                                      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.
                                      $endgroup$
                                      – Wît Wisarhd
                                      Dec 11 '18 at 5:10










                                    • $begingroup$
                                      Thanks Garf. Not sure how I managed to mess both of those up. Should be all good now.
                                      $endgroup$
                                      – acornellier
                                      Dec 13 '18 at 4:45



















                                    1












                                    $begingroup$

                                    JavaScript, 48 43 36 bytes



                                    -5 bytes courtesy of @Bubbler
                                    *-7 bytes courtesy of @Shaggy



                                    Input is a character array and output is an array of character arrays.



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


                                    Try it online!






                                    share|improve this answer











                                    $endgroup$









                                    • 1




                                      $begingroup$
                                      43 bytes.
                                      $endgroup$
                                      – Bubbler
                                      Dec 10 '18 at 1:54








                                    • 1




                                      $begingroup$
                                      36 bytes
                                      $endgroup$
                                      – Shaggy
                                      Jan 8 at 16:00










                                    • $begingroup$
                                      @Shaggy Is that a valid byte count and entry? Does [..."john"] not count as manipulation of the input string to an array before the function call?
                                      $endgroup$
                                      – guest271314
                                      Jan 8 at 16:12












                                    • $begingroup$
                                      @guest271314, input is a character and output is an array of character arrays which are permitted by the challenge spec and our I/O defaults.
                                      $endgroup$
                                      – Shaggy
                                      Jan 8 at 16:18










                                    • $begingroup$
                                      @Shaggy Updated. Can you kindly leave your above comment? Or should your comment be included at the answer to avoid confusion? Or is neither necessary?
                                      $endgroup$
                                      – guest271314
                                      Jan 8 at 16:23





















                                    1












                                    $begingroup$

                                    Common Lisp, 88 bytes



                                    (lambda(x)(loop for s from 1 to(length x)do(format t"~a~a "(subseq x s)(subseq x 0 s))))


                                    Try it online!






                                    share|improve this answer









                                    $endgroup$





















                                      1












                                      $begingroup$


                                      MBASIC, 69 66 bytes



                                      -3 bytes, thanks to Ørjan Johansen



                                      1 INPUT S$:L=LEN(S$):FOR I=1 TO L:S$=MID$(S$+S$,2,L):PRINT S$:NEXT





                                      share|improve this answer











                                      $endgroup$













                                      • $begingroup$
                                        I suspect you can shorten that to 1 INPUT S$:L=LEN(S$):FOR I=1 TO L:S$=MID$(S$+S$,2,L):PRINT S$:NEXT.
                                        $endgroup$
                                        – Ørjan Johansen
                                        Jan 12 at 2:22










                                      • $begingroup$
                                        @Ørjan Johansen Very nice, thank you.
                                        $endgroup$
                                        – wooshinyobject
                                        Jan 14 at 17:58



















                                      0












                                      $begingroup$


                                      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











                                      $endgroup$





















                                        0












                                        $begingroup$


                                        Tcl, 78 bytes



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


                                        Try it online!






                                        share|improve this answer









                                        $endgroup$

















                                          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',
                                          autoActivateHeartbeat: false,
                                          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
                                          });


                                          }
                                          });














                                          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

























                                          45 Answers
                                          45






                                          active

                                          oldest

                                          votes








                                          45 Answers
                                          45






                                          active

                                          oldest

                                          votes









                                          active

                                          oldest

                                          votes






                                          active

                                          oldest

                                          votes








                                          1 2
                                          next










                                          6












                                          $begingroup$


                                          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











                                          $endgroup$


















                                            6












                                            $begingroup$


                                            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











                                            $endgroup$
















                                              6












                                              6








                                              6





                                              $begingroup$


                                              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











                                              $endgroup$




                                              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 '18 at 23:30

























                                              answered Dec 8 '18 at 22:53









                                              Jonathan AllanJonathan Allan

                                              51.3k535166




                                              51.3k535166























                                                  8












                                                  $begingroup$

                                                  Haskell, 27 bytes



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


                                                  Try it online!






                                                  share|improve this answer









                                                  $endgroup$


















                                                    8












                                                    $begingroup$

                                                    Haskell, 27 bytes



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


                                                    Try it online!






                                                    share|improve this answer









                                                    $endgroup$
















                                                      8












                                                      8








                                                      8





                                                      $begingroup$

                                                      Haskell, 27 bytes



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


                                                      Try it online!






                                                      share|improve this answer









                                                      $endgroup$



                                                      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 '18 at 22:41









                                                      niminimi

                                                      31.5k32185




                                                      31.5k32185























                                                          6












                                                          $begingroup$


                                                          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









                                                          $endgroup$


















                                                            6












                                                            $begingroup$


                                                            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









                                                            $endgroup$
















                                                              6












                                                              6








                                                              6





                                                              $begingroup$


                                                              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









                                                              $endgroup$




                                                              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 '18 at 22:22









                                                              AdámAdám

                                                              29.5k271194




                                                              29.5k271194























                                                                  6












                                                                  $begingroup$


                                                                  Python 2, 38 bytes





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


                                                                  Try it online!






                                                                  share|improve this answer









                                                                  $endgroup$













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










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










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
















                                                                  6












                                                                  $begingroup$


                                                                  Python 2, 38 bytes





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


                                                                  Try it online!






                                                                  share|improve this answer









                                                                  $endgroup$













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










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










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














                                                                  6












                                                                  6








                                                                  6





                                                                  $begingroup$


                                                                  Python 2, 38 bytes





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


                                                                  Try it online!






                                                                  share|improve this answer









                                                                  $endgroup$




                                                                  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 '18 at 0:00









                                                                  xnorxnor

                                                                  89.9k18185439




                                                                  89.9k18185439












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










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










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


















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










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










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
















                                                                  $begingroup$
                                                                  Python 3 is only 9 more bytes.
                                                                  $endgroup$
                                                                  – wizzwizz4
                                                                  Dec 9 '18 at 18:42




                                                                  $begingroup$
                                                                  Python 3 is only 9 more bytes.
                                                                  $endgroup$
                                                                  – wizzwizz4
                                                                  Dec 9 '18 at 18:42












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




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












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




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











                                                                  6












                                                                  $begingroup$

                                                                  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











                                                                  $endgroup$


















                                                                    6












                                                                    $begingroup$

                                                                    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











                                                                    $endgroup$
















                                                                      6












                                                                      6








                                                                      6





                                                                      $begingroup$

                                                                      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











                                                                      $endgroup$



                                                                      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 '18 at 20:33

























                                                                      answered Dec 8 '18 at 23:28









                                                                      ArnauldArnauld

                                                                      73.6k689309




                                                                      73.6k689309























                                                                          4












                                                                          $begingroup$

                                                                          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











                                                                          $endgroup$


















                                                                            4












                                                                            $begingroup$

                                                                            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











                                                                            $endgroup$
















                                                                              4












                                                                              4








                                                                              4





                                                                              $begingroup$

                                                                              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











                                                                              $endgroup$



                                                                              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 '18 at 16:56

























                                                                              answered Dec 8 '18 at 22:38









                                                                              ShaggyShaggy

                                                                              19.3k21666




                                                                              19.3k21666























                                                                                  3












                                                                                  $begingroup$


                                                                                  05AB1E, 3 bytes



                                                                                  ā._


                                                                                  Try it online!






                                                                                  share|improve this answer











                                                                                  $endgroup$


















                                                                                    3












                                                                                    $begingroup$


                                                                                    05AB1E, 3 bytes



                                                                                    ā._


                                                                                    Try it online!






                                                                                    share|improve this answer











                                                                                    $endgroup$
















                                                                                      3












                                                                                      3








                                                                                      3





                                                                                      $begingroup$


                                                                                      05AB1E, 3 bytes



                                                                                      ā._


                                                                                      Try it online!






                                                                                      share|improve this answer











                                                                                      $endgroup$




                                                                                      05AB1E, 3 bytes



                                                                                      ā._


                                                                                      Try it online!







                                                                                      share|improve this answer














                                                                                      share|improve this answer



                                                                                      share|improve this answer








                                                                                      edited Dec 8 '18 at 22:58

























                                                                                      answered Dec 8 '18 at 22:28









                                                                                      OkxOkx

                                                                                      12.6k127102




                                                                                      12.6k127102























                                                                                          3












                                                                                          $begingroup$


                                                                                          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









                                                                                          $endgroup$


















                                                                                            3












                                                                                            $begingroup$


                                                                                            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









                                                                                            $endgroup$
















                                                                                              3












                                                                                              3








                                                                                              3





                                                                                              $begingroup$


                                                                                              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









                                                                                              $endgroup$




                                                                                              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 '18 at 23:23









                                                                                              Jo KingJo King

                                                                                              21.4k248110




                                                                                              21.4k248110























                                                                                                  3












                                                                                                  $begingroup$


                                                                                                  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











                                                                                                  $endgroup$













                                                                                                  • $begingroup$
                                                                                                    @LuisMendo Clever! Thanks!
                                                                                                    $endgroup$
                                                                                                    – Suever
                                                                                                    Dec 12 '18 at 10:50
















                                                                                                  3












                                                                                                  $begingroup$


                                                                                                  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











                                                                                                  $endgroup$













                                                                                                  • $begingroup$
                                                                                                    @LuisMendo Clever! Thanks!
                                                                                                    $endgroup$
                                                                                                    – Suever
                                                                                                    Dec 12 '18 at 10:50














                                                                                                  3












                                                                                                  3








                                                                                                  3





                                                                                                  $begingroup$


                                                                                                  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











                                                                                                  $endgroup$




                                                                                                  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 Dec 12 '18 at 10:50

























                                                                                                  answered Dec 9 '18 at 21:49









                                                                                                  SueverSuever

                                                                                                  9,6021345




                                                                                                  9,6021345












                                                                                                  • $begingroup$
                                                                                                    @LuisMendo Clever! Thanks!
                                                                                                    $endgroup$
                                                                                                    – Suever
                                                                                                    Dec 12 '18 at 10:50


















                                                                                                  • $begingroup$
                                                                                                    @LuisMendo Clever! Thanks!
                                                                                                    $endgroup$
                                                                                                    – Suever
                                                                                                    Dec 12 '18 at 10:50
















                                                                                                  $begingroup$
                                                                                                  @LuisMendo Clever! Thanks!
                                                                                                  $endgroup$
                                                                                                  – Suever
                                                                                                  Dec 12 '18 at 10:50




                                                                                                  $begingroup$
                                                                                                  @LuisMendo Clever! Thanks!
                                                                                                  $endgroup$
                                                                                                  – Suever
                                                                                                  Dec 12 '18 at 10:50











                                                                                                  3












                                                                                                  $begingroup$


                                                                                                  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











                                                                                                  $endgroup$













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










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


















                                                                                                  3












                                                                                                  $begingroup$


                                                                                                  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











                                                                                                  $endgroup$













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










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
















                                                                                                  3












                                                                                                  3








                                                                                                  3





                                                                                                  $begingroup$


                                                                                                  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











                                                                                                  $endgroup$




                                                                                                  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 Dec 12 '18 at 21:21

























                                                                                                  answered Dec 9 '18 at 0:04









                                                                                                  Misha LavrovMisha Lavrov

                                                                                                  4,221424




                                                                                                  4,221424












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










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




















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










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


















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




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












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






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













                                                                                                  2












                                                                                                  $begingroup$


                                                                                                  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









                                                                                                  $endgroup$


















                                                                                                    2












                                                                                                    $begingroup$


                                                                                                    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









                                                                                                    $endgroup$
















                                                                                                      2












                                                                                                      2








                                                                                                      2





                                                                                                      $begingroup$


                                                                                                      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









                                                                                                      $endgroup$




                                                                                                      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 '18 at 0:40









                                                                                                      Conor O'BrienConor O'Brien

                                                                                                      29.2k263162




                                                                                                      29.2k263162























                                                                                                          2












                                                                                                          $begingroup$


                                                                                                          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









                                                                                                          $endgroup$









                                                                                                          • 2




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










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


















                                                                                                          2












                                                                                                          $begingroup$


                                                                                                          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









                                                                                                          $endgroup$









                                                                                                          • 2




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










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
















                                                                                                          2












                                                                                                          2








                                                                                                          2





                                                                                                          $begingroup$


                                                                                                          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









                                                                                                          $endgroup$




                                                                                                          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 '18 at 7:52









                                                                                                          Galen IvanovGalen Ivanov

                                                                                                          6,54711032




                                                                                                          6,54711032








                                                                                                          • 2




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










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
















                                                                                                          • 2




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










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










                                                                                                          2




                                                                                                          2




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




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












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






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













                                                                                                          2












                                                                                                          $begingroup$


                                                                                                          R, 58 bytes





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


                                                                                                          Try it online!






                                                                                                          share|improve this answer









                                                                                                          $endgroup$


















                                                                                                            2












                                                                                                            $begingroup$


                                                                                                            R, 58 bytes





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


                                                                                                            Try it online!






                                                                                                            share|improve this answer









                                                                                                            $endgroup$
















                                                                                                              2












                                                                                                              2








                                                                                                              2





                                                                                                              $begingroup$


                                                                                                              R, 58 bytes





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


                                                                                                              Try it online!






                                                                                                              share|improve this answer









                                                                                                              $endgroup$




                                                                                                              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 '18 at 17:43









                                                                                                              digEmAlldigEmAll

                                                                                                              3,019414




                                                                                                              3,019414























                                                                                                                  2












                                                                                                                  $begingroup$


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





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


                                                                                                                  Try it online!






                                                                                                                  share|improve this answer











                                                                                                                  $endgroup$


















                                                                                                                    2












                                                                                                                    $begingroup$


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





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


                                                                                                                    Try it online!






                                                                                                                    share|improve this answer











                                                                                                                    $endgroup$
















                                                                                                                      2












                                                                                                                      2








                                                                                                                      2





                                                                                                                      $begingroup$


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





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


                                                                                                                      Try it online!






                                                                                                                      share|improve this answer











                                                                                                                      $endgroup$




                                                                                                                      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 '18 at 1:55

























                                                                                                                      answered Dec 9 '18 at 23:26









                                                                                                                      danadana

                                                                                                                      68145




                                                                                                                      68145























                                                                                                                          2












                                                                                                                          $begingroup$

                                                                                                                          C (32-bit), 58 51 50 bytes



                                                                                                                          -1 byte for a nice round number thanks to ceilingcat





                                                                                                                          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.
                                                                                                                          // Increment i and take its complement, and add it to the
                                                                                                                          // return value of printf(); which just happens to be strlen(s)+1.
                                                                                                                          // ~i + strlen(s) + 1 == strlen(s) + 1 - i - 1, so the last printed
                                                                                                                          // string is the original string.
                                                                                                                          ~++i + printf("%s%.*sn",s+i,i,s);
                                                                                                                          // The printf prints two strings: first until the terminating ,
                                                                                                                          // the second until a or until i chars have been printed. It also
                                                                                                                          // prints a linefeed.
                                                                                                                          }





                                                                                                                          share|improve this answer











                                                                                                                          $endgroup$













                                                                                                                          • $begingroup$
                                                                                                                            Suggest ~++i+printf("%s%.*sn",s+i,i,s) instead of i++<printf("%s%.*sn",s+i,i,s)-2
                                                                                                                            $endgroup$
                                                                                                                            – ceilingcat
                                                                                                                            Jan 7 at 9:06










                                                                                                                          • $begingroup$
                                                                                                                            @ceilingcat Thanks, as always!
                                                                                                                            $endgroup$
                                                                                                                            – Rogem
                                                                                                                            Jan 8 at 8:54










                                                                                                                          • $begingroup$
                                                                                                                            @ceilingcat You really should be called flooringcat.
                                                                                                                            $endgroup$
                                                                                                                            – Rogem
                                                                                                                            Jan 8 at 8:54
















                                                                                                                          2












                                                                                                                          $begingroup$

                                                                                                                          C (32-bit), 58 51 50 bytes



                                                                                                                          -1 byte for a nice round number thanks to ceilingcat





                                                                                                                          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.
                                                                                                                          // Increment i and take its complement, and add it to the
                                                                                                                          // return value of printf(); which just happens to be strlen(s)+1.
                                                                                                                          // ~i + strlen(s) + 1 == strlen(s) + 1 - i - 1, so the last printed
                                                                                                                          // string is the original string.
                                                                                                                          ~++i + printf("%s%.*sn",s+i,i,s);
                                                                                                                          // The printf prints two strings: first until the terminating ,
                                                                                                                          // the second until a or until i chars have been printed. It also
                                                                                                                          // prints a linefeed.
                                                                                                                          }





                                                                                                                          share|improve this answer











                                                                                                                          $endgroup$













                                                                                                                          • $begingroup$
                                                                                                                            Suggest ~++i+printf("%s%.*sn",s+i,i,s) instead of i++<printf("%s%.*sn",s+i,i,s)-2
                                                                                                                            $endgroup$
                                                                                                                            – ceilingcat
                                                                                                                            Jan 7 at 9:06










                                                                                                                          • $begingroup$
                                                                                                                            @ceilingcat Thanks, as always!
                                                                                                                            $endgroup$
                                                                                                                            – Rogem
                                                                                                                            Jan 8 at 8:54










                                                                                                                          • $begingroup$
                                                                                                                            @ceilingcat You really should be called flooringcat.
                                                                                                                            $endgroup$
                                                                                                                            – Rogem
                                                                                                                            Jan 8 at 8:54














                                                                                                                          2












                                                                                                                          2








                                                                                                                          2





                                                                                                                          $begingroup$

                                                                                                                          C (32-bit), 58 51 50 bytes



                                                                                                                          -1 byte for a nice round number thanks to ceilingcat





                                                                                                                          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.
                                                                                                                          // Increment i and take its complement, and add it to the
                                                                                                                          // return value of printf(); which just happens to be strlen(s)+1.
                                                                                                                          // ~i + strlen(s) + 1 == strlen(s) + 1 - i - 1, so the last printed
                                                                                                                          // string is the original string.
                                                                                                                          ~++i + printf("%s%.*sn",s+i,i,s);
                                                                                                                          // The printf prints two strings: first until the terminating ,
                                                                                                                          // the second until a or until i chars have been printed. It also
                                                                                                                          // prints a linefeed.
                                                                                                                          }





                                                                                                                          share|improve this answer











                                                                                                                          $endgroup$



                                                                                                                          C (32-bit), 58 51 50 bytes



                                                                                                                          -1 byte for a nice round number thanks to ceilingcat





                                                                                                                          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.
                                                                                                                          // Increment i and take its complement, and add it to the
                                                                                                                          // return value of printf(); which just happens to be strlen(s)+1.
                                                                                                                          // ~i + strlen(s) + 1 == strlen(s) + 1 - i - 1, so the last printed
                                                                                                                          // string is the original string.
                                                                                                                          ~++i + printf("%s%.*sn",s+i,i,s);
                                                                                                                          // The printf prints two strings: first until the terminating ,
                                                                                                                          // the second until a or until i chars have been printed. It also
                                                                                                                          // prints a linefeed.
                                                                                                                          }






                                                                                                                          share|improve this answer














                                                                                                                          share|improve this answer



                                                                                                                          share|improve this answer








                                                                                                                          edited Jan 8 at 8:53

























                                                                                                                          answered Dec 9 '18 at 18:47









                                                                                                                          RogemRogem

                                                                                                                          701112




                                                                                                                          701112












                                                                                                                          • $begingroup$
                                                                                                                            Suggest ~++i+printf("%s%.*sn",s+i,i,s) instead of i++<printf("%s%.*sn",s+i,i,s)-2
                                                                                                                            $endgroup$
                                                                                                                            – ceilingcat
                                                                                                                            Jan 7 at 9:06










                                                                                                                          • $begingroup$
                                                                                                                            @ceilingcat Thanks, as always!
                                                                                                                            $endgroup$
                                                                                                                            – Rogem
                                                                                                                            Jan 8 at 8:54










                                                                                                                          • $begingroup$
                                                                                                                            @ceilingcat You really should be called flooringcat.
                                                                                                                            $endgroup$
                                                                                                                            – Rogem
                                                                                                                            Jan 8 at 8:54


















                                                                                                                          • $begingroup$
                                                                                                                            Suggest ~++i+printf("%s%.*sn",s+i,i,s) instead of i++<printf("%s%.*sn",s+i,i,s)-2
                                                                                                                            $endgroup$
                                                                                                                            – ceilingcat
                                                                                                                            Jan 7 at 9:06










                                                                                                                          • $begingroup$
                                                                                                                            @ceilingcat Thanks, as always!
                                                                                                                            $endgroup$
                                                                                                                            – Rogem
                                                                                                                            Jan 8 at 8:54










                                                                                                                          • $begingroup$
                                                                                                                            @ceilingcat You really should be called flooringcat.
                                                                                                                            $endgroup$
                                                                                                                            – Rogem
                                                                                                                            Jan 8 at 8:54
















                                                                                                                          $begingroup$
                                                                                                                          Suggest ~++i+printf("%s%.*sn",s+i,i,s) instead of i++<printf("%s%.*sn",s+i,i,s)-2
                                                                                                                          $endgroup$
                                                                                                                          – ceilingcat
                                                                                                                          Jan 7 at 9:06




                                                                                                                          $begingroup$
                                                                                                                          Suggest ~++i+printf("%s%.*sn",s+i,i,s) instead of i++<printf("%s%.*sn",s+i,i,s)-2
                                                                                                                          $endgroup$
                                                                                                                          – ceilingcat
                                                                                                                          Jan 7 at 9:06












                                                                                                                          $begingroup$
                                                                                                                          @ceilingcat Thanks, as always!
                                                                                                                          $endgroup$
                                                                                                                          – Rogem
                                                                                                                          Jan 8 at 8:54




                                                                                                                          $begingroup$
                                                                                                                          @ceilingcat Thanks, as always!
                                                                                                                          $endgroup$
                                                                                                                          – Rogem
                                                                                                                          Jan 8 at 8:54












                                                                                                                          $begingroup$
                                                                                                                          @ceilingcat You really should be called flooringcat.
                                                                                                                          $endgroup$
                                                                                                                          – Rogem
                                                                                                                          Jan 8 at 8:54




                                                                                                                          $begingroup$
                                                                                                                          @ceilingcat You really should be called flooringcat.
                                                                                                                          $endgroup$
                                                                                                                          – Rogem
                                                                                                                          Jan 8 at 8:54











                                                                                                                          1












                                                                                                                          $begingroup$


                                                                                                                          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









                                                                                                                          $endgroup$


















                                                                                                                            1












                                                                                                                            $begingroup$


                                                                                                                            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









                                                                                                                            $endgroup$
















                                                                                                                              1












                                                                                                                              1








                                                                                                                              1





                                                                                                                              $begingroup$


                                                                                                                              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









                                                                                                                              $endgroup$




                                                                                                                              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 '18 at 23:54









                                                                                                                              NeilNeil

                                                                                                                              79.9k744178




                                                                                                                              79.9k744178























                                                                                                                                  1












                                                                                                                                  $begingroup$


                                                                                                                                  Red, 49 43 bytes



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


                                                                                                                                  Try it online!






                                                                                                                                  share|improve this answer











                                                                                                                                  $endgroup$


















                                                                                                                                    1












                                                                                                                                    $begingroup$


                                                                                                                                    Red, 49 43 bytes



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


                                                                                                                                    Try it online!






                                                                                                                                    share|improve this answer











                                                                                                                                    $endgroup$
















                                                                                                                                      1












                                                                                                                                      1








                                                                                                                                      1





                                                                                                                                      $begingroup$


                                                                                                                                      Red, 49 43 bytes



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


                                                                                                                                      Try it online!






                                                                                                                                      share|improve this answer











                                                                                                                                      $endgroup$




                                                                                                                                      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 '18 at 9:15

























                                                                                                                                      answered Dec 9 '18 at 8:42









                                                                                                                                      Galen IvanovGalen Ivanov

                                                                                                                                      6,54711032




                                                                                                                                      6,54711032























                                                                                                                                          1












                                                                                                                                          $begingroup$


                                                                                                                                          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











                                                                                                                                          $endgroup$


















                                                                                                                                            1












                                                                                                                                            $begingroup$


                                                                                                                                            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











                                                                                                                                            $endgroup$
















                                                                                                                                              1












                                                                                                                                              1








                                                                                                                                              1





                                                                                                                                              $begingroup$


                                                                                                                                              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











                                                                                                                                              $endgroup$




                                                                                                                                              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 '18 at 15:56

























                                                                                                                                              answered Dec 9 '18 at 9:03









                                                                                                                                              ElPedroElPedro

                                                                                                                                              3,4831023




                                                                                                                                              3,4831023























                                                                                                                                                  1












                                                                                                                                                  $begingroup$


                                                                                                                                                  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









                                                                                                                                                  $endgroup$


















                                                                                                                                                    1












                                                                                                                                                    $begingroup$


                                                                                                                                                    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









                                                                                                                                                    $endgroup$
















                                                                                                                                                      1












                                                                                                                                                      1








                                                                                                                                                      1





                                                                                                                                                      $begingroup$


                                                                                                                                                      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









                                                                                                                                                      $endgroup$




                                                                                                                                                      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 '18 at 19:35









                                                                                                                                                      SeanSean

                                                                                                                                                      3,45637




                                                                                                                                                      3,45637























                                                                                                                                                          1












                                                                                                                                                          $begingroup$


                                                                                                                                                          Pushy, 4 bytes



                                                                                                                                                          L:{"


                                                                                                                                                          Try it online!



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





                                                                                                                                                          share|improve this answer









                                                                                                                                                          $endgroup$


















                                                                                                                                                            1












                                                                                                                                                            $begingroup$


                                                                                                                                                            Pushy, 4 bytes



                                                                                                                                                            L:{"


                                                                                                                                                            Try it online!



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





                                                                                                                                                            share|improve this answer









                                                                                                                                                            $endgroup$
















                                                                                                                                                              1












                                                                                                                                                              1








                                                                                                                                                              1





                                                                                                                                                              $begingroup$


                                                                                                                                                              Pushy, 4 bytes



                                                                                                                                                              L:{"


                                                                                                                                                              Try it online!



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





                                                                                                                                                              share|improve this answer









                                                                                                                                                              $endgroup$




                                                                                                                                                              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 '18 at 21:57









                                                                                                                                                              FlipTackFlipTack

                                                                                                                                                              9,14334089




                                                                                                                                                              9,14334089























                                                                                                                                                                  1












                                                                                                                                                                  $begingroup$


                                                                                                                                                                  V, 8 bytes



                                                                                                                                                                  ýñx$pÙñd


                                                                                                                                                                  Try it online!



                                                                                                                                                                  Hexdump:



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





                                                                                                                                                                  share|improve this answer











                                                                                                                                                                  $endgroup$













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










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










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
















                                                                                                                                                                  1












                                                                                                                                                                  $begingroup$


                                                                                                                                                                  V, 8 bytes



                                                                                                                                                                  ýñx$pÙñd


                                                                                                                                                                  Try it online!



                                                                                                                                                                  Hexdump:



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





                                                                                                                                                                  share|improve this answer











                                                                                                                                                                  $endgroup$













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










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










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














                                                                                                                                                                  1












                                                                                                                                                                  1








                                                                                                                                                                  1





                                                                                                                                                                  $begingroup$


                                                                                                                                                                  V, 8 bytes



                                                                                                                                                                  ýñx$pÙñd


                                                                                                                                                                  Try it online!



                                                                                                                                                                  Hexdump:



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





                                                                                                                                                                  share|improve this answer











                                                                                                                                                                  $endgroup$




                                                                                                                                                                  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 '18 at 7:35

























                                                                                                                                                                  answered Dec 8 '18 at 22:21









                                                                                                                                                                  DJMcMayhemDJMcMayhem

                                                                                                                                                                  40.9k11145309




                                                                                                                                                                  40.9k11145309












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










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










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


















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










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










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
















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




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












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




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












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




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











                                                                                                                                                                  1












                                                                                                                                                                  $begingroup$

                                                                                                                                                                  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









                                                                                                                                                                  $endgroup$


















                                                                                                                                                                    1












                                                                                                                                                                    $begingroup$

                                                                                                                                                                    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









                                                                                                                                                                    $endgroup$
















                                                                                                                                                                      1












                                                                                                                                                                      1








                                                                                                                                                                      1





                                                                                                                                                                      $begingroup$

                                                                                                                                                                      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









                                                                                                                                                                      $endgroup$



                                                                                                                                                                      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 '18 at 9:08









                                                                                                                                                                      mazzymazzy

                                                                                                                                                                      2,2851315




                                                                                                                                                                      2,2851315























                                                                                                                                                                          1












                                                                                                                                                                          $begingroup$


                                                                                                                                                                          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











                                                                                                                                                                          $endgroup$













                                                                                                                                                                          • $begingroup$
                                                                                                                                                                            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]}
                                                                                                                                                                            $endgroup$
                                                                                                                                                                            – david
                                                                                                                                                                            Dec 9 '18 at 18:05










                                                                                                                                                                          • $begingroup$
                                                                                                                                                                            Got it down to 80 bytes, thanks to @david
                                                                                                                                                                            $endgroup$
                                                                                                                                                                            – sergiol
                                                                                                                                                                            Dec 10 '18 at 10:54
















                                                                                                                                                                          1












                                                                                                                                                                          $begingroup$


                                                                                                                                                                          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











                                                                                                                                                                          $endgroup$













                                                                                                                                                                          • $begingroup$
                                                                                                                                                                            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]}
                                                                                                                                                                            $endgroup$
                                                                                                                                                                            – david
                                                                                                                                                                            Dec 9 '18 at 18:05










                                                                                                                                                                          • $begingroup$
                                                                                                                                                                            Got it down to 80 bytes, thanks to @david
                                                                                                                                                                            $endgroup$
                                                                                                                                                                            – sergiol
                                                                                                                                                                            Dec 10 '18 at 10:54














                                                                                                                                                                          1












                                                                                                                                                                          1








                                                                                                                                                                          1





                                                                                                                                                                          $begingroup$


                                                                                                                                                                          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











                                                                                                                                                                          $endgroup$




                                                                                                                                                                          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 '18 at 10:54

























                                                                                                                                                                          answered Dec 8 '18 at 23:50









                                                                                                                                                                          sergiolsergiol

                                                                                                                                                                          2,5271925




                                                                                                                                                                          2,5271925












                                                                                                                                                                          • $begingroup$
                                                                                                                                                                            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]}
                                                                                                                                                                            $endgroup$
                                                                                                                                                                            – david
                                                                                                                                                                            Dec 9 '18 at 18:05










                                                                                                                                                                          • $begingroup$
                                                                                                                                                                            Got it down to 80 bytes, thanks to @david
                                                                                                                                                                            $endgroup$
                                                                                                                                                                            – sergiol
                                                                                                                                                                            Dec 10 '18 at 10:54


















                                                                                                                                                                          • $begingroup$
                                                                                                                                                                            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]}
                                                                                                                                                                            $endgroup$
                                                                                                                                                                            – david
                                                                                                                                                                            Dec 9 '18 at 18:05










                                                                                                                                                                          • $begingroup$
                                                                                                                                                                            Got it down to 80 bytes, thanks to @david
                                                                                                                                                                            $endgroup$
                                                                                                                                                                            – sergiol
                                                                                                                                                                            Dec 10 '18 at 10:54
















                                                                                                                                                                          $begingroup$
                                                                                                                                                                          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]}
                                                                                                                                                                          $endgroup$
                                                                                                                                                                          – david
                                                                                                                                                                          Dec 9 '18 at 18:05




                                                                                                                                                                          $begingroup$
                                                                                                                                                                          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]}
                                                                                                                                                                          $endgroup$
                                                                                                                                                                          – david
                                                                                                                                                                          Dec 9 '18 at 18:05












                                                                                                                                                                          $begingroup$
                                                                                                                                                                          Got it down to 80 bytes, thanks to @david
                                                                                                                                                                          $endgroup$
                                                                                                                                                                          – sergiol
                                                                                                                                                                          Dec 10 '18 at 10:54




                                                                                                                                                                          $begingroup$
                                                                                                                                                                          Got it down to 80 bytes, thanks to @david
                                                                                                                                                                          $endgroup$
                                                                                                                                                                          – sergiol
                                                                                                                                                                          Dec 10 '18 at 10:54











                                                                                                                                                                          1












                                                                                                                                                                          $begingroup$


                                                                                                                                                                          SNOBOL4 (CSNOBOL4), 82 bytes



                                                                                                                                                                          	S =INPUT
                                                                                                                                                                          T X =X + 1
                                                                                                                                                                          S LEN(1) . L REM . R
                                                                                                                                                                          OUTPUT =S =R L LE(X,SIZE(S)) :S(T)
                                                                                                                                                                          END


                                                                                                                                                                          Try it online!






                                                                                                                                                                          share|improve this answer









                                                                                                                                                                          $endgroup$


















                                                                                                                                                                            1












                                                                                                                                                                            $begingroup$


                                                                                                                                                                            SNOBOL4 (CSNOBOL4), 82 bytes



                                                                                                                                                                            	S =INPUT
                                                                                                                                                                            T X =X + 1
                                                                                                                                                                            S LEN(1) . L REM . R
                                                                                                                                                                            OUTPUT =S =R L LE(X,SIZE(S)) :S(T)
                                                                                                                                                                            END


                                                                                                                                                                            Try it online!






                                                                                                                                                                            share|improve this answer









                                                                                                                                                                            $endgroup$
















                                                                                                                                                                              1












                                                                                                                                                                              1








                                                                                                                                                                              1





                                                                                                                                                                              $begingroup$


                                                                                                                                                                              SNOBOL4 (CSNOBOL4), 82 bytes



                                                                                                                                                                              	S =INPUT
                                                                                                                                                                              T X =X + 1
                                                                                                                                                                              S LEN(1) . L REM . R
                                                                                                                                                                              OUTPUT =S =R L LE(X,SIZE(S)) :S(T)
                                                                                                                                                                              END


                                                                                                                                                                              Try it online!






                                                                                                                                                                              share|improve this answer









                                                                                                                                                                              $endgroup$




                                                                                                                                                                              SNOBOL4 (CSNOBOL4), 82 bytes



                                                                                                                                                                              	S =INPUT
                                                                                                                                                                              T X =X + 1
                                                                                                                                                                              S LEN(1) . L REM . R
                                                                                                                                                                              OUTPUT =S =R L LE(X,SIZE(S)) :S(T)
                                                                                                                                                                              END


                                                                                                                                                                              Try it online!







                                                                                                                                                                              share|improve this answer












                                                                                                                                                                              share|improve this answer



                                                                                                                                                                              share|improve this answer










                                                                                                                                                                              answered Dec 10 '18 at 22:01









                                                                                                                                                                              GiuseppeGiuseppe

                                                                                                                                                                              16.5k31052




                                                                                                                                                                              16.5k31052























                                                                                                                                                                                  1












                                                                                                                                                                                  $begingroup$


                                                                                                                                                                                  Ruby, 39 bytes





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


                                                                                                                                                                                  Try it online!






                                                                                                                                                                                  share|improve this answer











                                                                                                                                                                                  $endgroup$









                                                                                                                                                                                  • 1




                                                                                                                                                                                    $begingroup$
                                                                                                                                                                                    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.
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – Wît Wisarhd
                                                                                                                                                                                    Dec 11 '18 at 5:10










                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    Thanks Garf. Not sure how I managed to mess both of those up. Should be all good now.
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – acornellier
                                                                                                                                                                                    Dec 13 '18 at 4:45
















                                                                                                                                                                                  1












                                                                                                                                                                                  $begingroup$


                                                                                                                                                                                  Ruby, 39 bytes





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


                                                                                                                                                                                  Try it online!






                                                                                                                                                                                  share|improve this answer











                                                                                                                                                                                  $endgroup$









                                                                                                                                                                                  • 1




                                                                                                                                                                                    $begingroup$
                                                                                                                                                                                    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.
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – Wît Wisarhd
                                                                                                                                                                                    Dec 11 '18 at 5:10










                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    Thanks Garf. Not sure how I managed to mess both of those up. Should be all good now.
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – acornellier
                                                                                                                                                                                    Dec 13 '18 at 4:45














                                                                                                                                                                                  1












                                                                                                                                                                                  1








                                                                                                                                                                                  1





                                                                                                                                                                                  $begingroup$


                                                                                                                                                                                  Ruby, 39 bytes





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


                                                                                                                                                                                  Try it online!






                                                                                                                                                                                  share|improve this answer











                                                                                                                                                                                  $endgroup$




                                                                                                                                                                                  Ruby, 39 bytes





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


                                                                                                                                                                                  Try it online!







                                                                                                                                                                                  share|improve this answer














                                                                                                                                                                                  share|improve this answer



                                                                                                                                                                                  share|improve this answer








                                                                                                                                                                                  edited Dec 13 '18 at 4:47

























                                                                                                                                                                                  answered Dec 11 '18 at 4:57









                                                                                                                                                                                  acornellieracornellier

                                                                                                                                                                                  112




                                                                                                                                                                                  112








                                                                                                                                                                                  • 1




                                                                                                                                                                                    $begingroup$
                                                                                                                                                                                    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.
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – Wît Wisarhd
                                                                                                                                                                                    Dec 11 '18 at 5:10










                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    Thanks Garf. Not sure how I managed to mess both of those up. Should be all good now.
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – acornellier
                                                                                                                                                                                    Dec 13 '18 at 4:45














                                                                                                                                                                                  • 1




                                                                                                                                                                                    $begingroup$
                                                                                                                                                                                    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.
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – Wît Wisarhd
                                                                                                                                                                                    Dec 11 '18 at 5:10










                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    Thanks Garf. Not sure how I managed to mess both of those up. Should be all good now.
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – acornellier
                                                                                                                                                                                    Dec 13 '18 at 4:45








                                                                                                                                                                                  1




                                                                                                                                                                                  1




                                                                                                                                                                                  $begingroup$
                                                                                                                                                                                  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.
                                                                                                                                                                                  $endgroup$
                                                                                                                                                                                  – Wît Wisarhd
                                                                                                                                                                                  Dec 11 '18 at 5:10




                                                                                                                                                                                  $begingroup$
                                                                                                                                                                                  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.
                                                                                                                                                                                  $endgroup$
                                                                                                                                                                                  – Wît Wisarhd
                                                                                                                                                                                  Dec 11 '18 at 5:10












                                                                                                                                                                                  $begingroup$
                                                                                                                                                                                  Thanks Garf. Not sure how I managed to mess both of those up. Should be all good now.
                                                                                                                                                                                  $endgroup$
                                                                                                                                                                                  – acornellier
                                                                                                                                                                                  Dec 13 '18 at 4:45




                                                                                                                                                                                  $begingroup$
                                                                                                                                                                                  Thanks Garf. Not sure how I managed to mess both of those up. Should be all good now.
                                                                                                                                                                                  $endgroup$
                                                                                                                                                                                  – acornellier
                                                                                                                                                                                  Dec 13 '18 at 4:45











                                                                                                                                                                                  1












                                                                                                                                                                                  $begingroup$

                                                                                                                                                                                  JavaScript, 48 43 36 bytes



                                                                                                                                                                                  -5 bytes courtesy of @Bubbler
                                                                                                                                                                                  *-7 bytes courtesy of @Shaggy



                                                                                                                                                                                  Input is a character array and output is an array of character arrays.



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


                                                                                                                                                                                  Try it online!






                                                                                                                                                                                  share|improve this answer











                                                                                                                                                                                  $endgroup$









                                                                                                                                                                                  • 1




                                                                                                                                                                                    $begingroup$
                                                                                                                                                                                    43 bytes.
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – Bubbler
                                                                                                                                                                                    Dec 10 '18 at 1:54








                                                                                                                                                                                  • 1




                                                                                                                                                                                    $begingroup$
                                                                                                                                                                                    36 bytes
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – Shaggy
                                                                                                                                                                                    Jan 8 at 16:00










                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    @Shaggy Is that a valid byte count and entry? Does [..."john"] not count as manipulation of the input string to an array before the function call?
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – guest271314
                                                                                                                                                                                    Jan 8 at 16:12












                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    @guest271314, input is a character and output is an array of character arrays which are permitted by the challenge spec and our I/O defaults.
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – Shaggy
                                                                                                                                                                                    Jan 8 at 16:18










                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    @Shaggy Updated. Can you kindly leave your above comment? Or should your comment be included at the answer to avoid confusion? Or is neither necessary?
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – guest271314
                                                                                                                                                                                    Jan 8 at 16:23


















                                                                                                                                                                                  1












                                                                                                                                                                                  $begingroup$

                                                                                                                                                                                  JavaScript, 48 43 36 bytes



                                                                                                                                                                                  -5 bytes courtesy of @Bubbler
                                                                                                                                                                                  *-7 bytes courtesy of @Shaggy



                                                                                                                                                                                  Input is a character array and output is an array of character arrays.



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


                                                                                                                                                                                  Try it online!






                                                                                                                                                                                  share|improve this answer











                                                                                                                                                                                  $endgroup$









                                                                                                                                                                                  • 1




                                                                                                                                                                                    $begingroup$
                                                                                                                                                                                    43 bytes.
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – Bubbler
                                                                                                                                                                                    Dec 10 '18 at 1:54








                                                                                                                                                                                  • 1




                                                                                                                                                                                    $begingroup$
                                                                                                                                                                                    36 bytes
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – Shaggy
                                                                                                                                                                                    Jan 8 at 16:00










                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    @Shaggy Is that a valid byte count and entry? Does [..."john"] not count as manipulation of the input string to an array before the function call?
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – guest271314
                                                                                                                                                                                    Jan 8 at 16:12












                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    @guest271314, input is a character and output is an array of character arrays which are permitted by the challenge spec and our I/O defaults.
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – Shaggy
                                                                                                                                                                                    Jan 8 at 16:18










                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    @Shaggy Updated. Can you kindly leave your above comment? Or should your comment be included at the answer to avoid confusion? Or is neither necessary?
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – guest271314
                                                                                                                                                                                    Jan 8 at 16:23
















                                                                                                                                                                                  1












                                                                                                                                                                                  1








                                                                                                                                                                                  1





                                                                                                                                                                                  $begingroup$

                                                                                                                                                                                  JavaScript, 48 43 36 bytes



                                                                                                                                                                                  -5 bytes courtesy of @Bubbler
                                                                                                                                                                                  *-7 bytes courtesy of @Shaggy



                                                                                                                                                                                  Input is a character array and output is an array of character arrays.



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


                                                                                                                                                                                  Try it online!






                                                                                                                                                                                  share|improve this answer











                                                                                                                                                                                  $endgroup$



                                                                                                                                                                                  JavaScript, 48 43 36 bytes



                                                                                                                                                                                  -5 bytes courtesy of @Bubbler
                                                                                                                                                                                  *-7 bytes courtesy of @Shaggy



                                                                                                                                                                                  Input is a character array and output is an array of character arrays.



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


                                                                                                                                                                                  Try it online!







                                                                                                                                                                                  share|improve this answer














                                                                                                                                                                                  share|improve this answer



                                                                                                                                                                                  share|improve this answer








                                                                                                                                                                                  edited Jan 8 at 16:31









                                                                                                                                                                                  Shaggy

                                                                                                                                                                                  19.3k21666




                                                                                                                                                                                  19.3k21666










                                                                                                                                                                                  answered Dec 10 '18 at 0:58









                                                                                                                                                                                  guest271314guest271314

                                                                                                                                                                                  327211




                                                                                                                                                                                  327211








                                                                                                                                                                                  • 1




                                                                                                                                                                                    $begingroup$
                                                                                                                                                                                    43 bytes.
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – Bubbler
                                                                                                                                                                                    Dec 10 '18 at 1:54








                                                                                                                                                                                  • 1




                                                                                                                                                                                    $begingroup$
                                                                                                                                                                                    36 bytes
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – Shaggy
                                                                                                                                                                                    Jan 8 at 16:00










                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    @Shaggy Is that a valid byte count and entry? Does [..."john"] not count as manipulation of the input string to an array before the function call?
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – guest271314
                                                                                                                                                                                    Jan 8 at 16:12












                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    @guest271314, input is a character and output is an array of character arrays which are permitted by the challenge spec and our I/O defaults.
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – Shaggy
                                                                                                                                                                                    Jan 8 at 16:18










                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    @Shaggy Updated. Can you kindly leave your above comment? Or should your comment be included at the answer to avoid confusion? Or is neither necessary?
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – guest271314
                                                                                                                                                                                    Jan 8 at 16:23
















                                                                                                                                                                                  • 1




                                                                                                                                                                                    $begingroup$
                                                                                                                                                                                    43 bytes.
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – Bubbler
                                                                                                                                                                                    Dec 10 '18 at 1:54








                                                                                                                                                                                  • 1




                                                                                                                                                                                    $begingroup$
                                                                                                                                                                                    36 bytes
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – Shaggy
                                                                                                                                                                                    Jan 8 at 16:00










                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    @Shaggy Is that a valid byte count and entry? Does [..."john"] not count as manipulation of the input string to an array before the function call?
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – guest271314
                                                                                                                                                                                    Jan 8 at 16:12












                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    @guest271314, input is a character and output is an array of character arrays which are permitted by the challenge spec and our I/O defaults.
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – Shaggy
                                                                                                                                                                                    Jan 8 at 16:18










                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    @Shaggy Updated. Can you kindly leave your above comment? Or should your comment be included at the answer to avoid confusion? Or is neither necessary?
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – guest271314
                                                                                                                                                                                    Jan 8 at 16:23










                                                                                                                                                                                  1




                                                                                                                                                                                  1




                                                                                                                                                                                  $begingroup$
                                                                                                                                                                                  43 bytes.
                                                                                                                                                                                  $endgroup$
                                                                                                                                                                                  – Bubbler
                                                                                                                                                                                  Dec 10 '18 at 1:54






                                                                                                                                                                                  $begingroup$
                                                                                                                                                                                  43 bytes.
                                                                                                                                                                                  $endgroup$
                                                                                                                                                                                  – Bubbler
                                                                                                                                                                                  Dec 10 '18 at 1:54






                                                                                                                                                                                  1




                                                                                                                                                                                  1




                                                                                                                                                                                  $begingroup$
                                                                                                                                                                                  36 bytes
                                                                                                                                                                                  $endgroup$
                                                                                                                                                                                  – Shaggy
                                                                                                                                                                                  Jan 8 at 16:00




                                                                                                                                                                                  $begingroup$
                                                                                                                                                                                  36 bytes
                                                                                                                                                                                  $endgroup$
                                                                                                                                                                                  – Shaggy
                                                                                                                                                                                  Jan 8 at 16:00












                                                                                                                                                                                  $begingroup$
                                                                                                                                                                                  @Shaggy Is that a valid byte count and entry? Does [..."john"] not count as manipulation of the input string to an array before the function call?
                                                                                                                                                                                  $endgroup$
                                                                                                                                                                                  – guest271314
                                                                                                                                                                                  Jan 8 at 16:12






                                                                                                                                                                                  $begingroup$
                                                                                                                                                                                  @Shaggy Is that a valid byte count and entry? Does [..."john"] not count as manipulation of the input string to an array before the function call?
                                                                                                                                                                                  $endgroup$
                                                                                                                                                                                  – guest271314
                                                                                                                                                                                  Jan 8 at 16:12














                                                                                                                                                                                  $begingroup$
                                                                                                                                                                                  @guest271314, input is a character and output is an array of character arrays which are permitted by the challenge spec and our I/O defaults.
                                                                                                                                                                                  $endgroup$
                                                                                                                                                                                  – Shaggy
                                                                                                                                                                                  Jan 8 at 16:18




                                                                                                                                                                                  $begingroup$
                                                                                                                                                                                  @guest271314, input is a character and output is an array of character arrays which are permitted by the challenge spec and our I/O defaults.
                                                                                                                                                                                  $endgroup$
                                                                                                                                                                                  – Shaggy
                                                                                                                                                                                  Jan 8 at 16:18












                                                                                                                                                                                  $begingroup$
                                                                                                                                                                                  @Shaggy Updated. Can you kindly leave your above comment? Or should your comment be included at the answer to avoid confusion? Or is neither necessary?
                                                                                                                                                                                  $endgroup$
                                                                                                                                                                                  – guest271314
                                                                                                                                                                                  Jan 8 at 16:23






                                                                                                                                                                                  $begingroup$
                                                                                                                                                                                  @Shaggy Updated. Can you kindly leave your above comment? Or should your comment be included at the answer to avoid confusion? Or is neither necessary?
                                                                                                                                                                                  $endgroup$
                                                                                                                                                                                  – guest271314
                                                                                                                                                                                  Jan 8 at 16:23













                                                                                                                                                                                  1












                                                                                                                                                                                  $begingroup$

                                                                                                                                                                                  Common Lisp, 88 bytes



                                                                                                                                                                                  (lambda(x)(loop for s from 1 to(length x)do(format t"~a~a "(subseq x s)(subseq x 0 s))))


                                                                                                                                                                                  Try it online!






                                                                                                                                                                                  share|improve this answer









                                                                                                                                                                                  $endgroup$


















                                                                                                                                                                                    1












                                                                                                                                                                                    $begingroup$

                                                                                                                                                                                    Common Lisp, 88 bytes



                                                                                                                                                                                    (lambda(x)(loop for s from 1 to(length x)do(format t"~a~a "(subseq x s)(subseq x 0 s))))


                                                                                                                                                                                    Try it online!






                                                                                                                                                                                    share|improve this answer









                                                                                                                                                                                    $endgroup$
















                                                                                                                                                                                      1












                                                                                                                                                                                      1








                                                                                                                                                                                      1





                                                                                                                                                                                      $begingroup$

                                                                                                                                                                                      Common Lisp, 88 bytes



                                                                                                                                                                                      (lambda(x)(loop for s from 1 to(length x)do(format t"~a~a "(subseq x s)(subseq x 0 s))))


                                                                                                                                                                                      Try it online!






                                                                                                                                                                                      share|improve this answer









                                                                                                                                                                                      $endgroup$



                                                                                                                                                                                      Common Lisp, 88 bytes



                                                                                                                                                                                      (lambda(x)(loop for s from 1 to(length x)do(format t"~a~a "(subseq x s)(subseq x 0 s))))


                                                                                                                                                                                      Try it online!







                                                                                                                                                                                      share|improve this answer












                                                                                                                                                                                      share|improve this answer



                                                                                                                                                                                      share|improve this answer










                                                                                                                                                                                      answered Jan 8 at 17:17









                                                                                                                                                                                      RenzoRenzo

                                                                                                                                                                                      1,670516




                                                                                                                                                                                      1,670516























                                                                                                                                                                                          1












                                                                                                                                                                                          $begingroup$


                                                                                                                                                                                          MBASIC, 69 66 bytes



                                                                                                                                                                                          -3 bytes, thanks to Ørjan Johansen



                                                                                                                                                                                          1 INPUT S$:L=LEN(S$):FOR I=1 TO L:S$=MID$(S$+S$,2,L):PRINT S$:NEXT





                                                                                                                                                                                          share|improve this answer











                                                                                                                                                                                          $endgroup$













                                                                                                                                                                                          • $begingroup$
                                                                                                                                                                                            I suspect you can shorten that to 1 INPUT S$:L=LEN(S$):FOR I=1 TO L:S$=MID$(S$+S$,2,L):PRINT S$:NEXT.
                                                                                                                                                                                            $endgroup$
                                                                                                                                                                                            – Ørjan Johansen
                                                                                                                                                                                            Jan 12 at 2:22










                                                                                                                                                                                          • $begingroup$
                                                                                                                                                                                            @Ørjan Johansen Very nice, thank you.
                                                                                                                                                                                            $endgroup$
                                                                                                                                                                                            – wooshinyobject
                                                                                                                                                                                            Jan 14 at 17:58
















                                                                                                                                                                                          1












                                                                                                                                                                                          $begingroup$


                                                                                                                                                                                          MBASIC, 69 66 bytes



                                                                                                                                                                                          -3 bytes, thanks to Ørjan Johansen



                                                                                                                                                                                          1 INPUT S$:L=LEN(S$):FOR I=1 TO L:S$=MID$(S$+S$,2,L):PRINT S$:NEXT





                                                                                                                                                                                          share|improve this answer











                                                                                                                                                                                          $endgroup$













                                                                                                                                                                                          • $begingroup$
                                                                                                                                                                                            I suspect you can shorten that to 1 INPUT S$:L=LEN(S$):FOR I=1 TO L:S$=MID$(S$+S$,2,L):PRINT S$:NEXT.
                                                                                                                                                                                            $endgroup$
                                                                                                                                                                                            – Ørjan Johansen
                                                                                                                                                                                            Jan 12 at 2:22










                                                                                                                                                                                          • $begingroup$
                                                                                                                                                                                            @Ørjan Johansen Very nice, thank you.
                                                                                                                                                                                            $endgroup$
                                                                                                                                                                                            – wooshinyobject
                                                                                                                                                                                            Jan 14 at 17:58














                                                                                                                                                                                          1












                                                                                                                                                                                          1








                                                                                                                                                                                          1





                                                                                                                                                                                          $begingroup$


                                                                                                                                                                                          MBASIC, 69 66 bytes



                                                                                                                                                                                          -3 bytes, thanks to Ørjan Johansen



                                                                                                                                                                                          1 INPUT S$:L=LEN(S$):FOR I=1 TO L:S$=MID$(S$+S$,2,L):PRINT S$:NEXT





                                                                                                                                                                                          share|improve this answer











                                                                                                                                                                                          $endgroup$




                                                                                                                                                                                          MBASIC, 69 66 bytes



                                                                                                                                                                                          -3 bytes, thanks to Ørjan Johansen



                                                                                                                                                                                          1 INPUT S$:L=LEN(S$):FOR I=1 TO L:S$=MID$(S$+S$,2,L):PRINT S$:NEXT






                                                                                                                                                                                          share|improve this answer














                                                                                                                                                                                          share|improve this answer



                                                                                                                                                                                          share|improve this answer








                                                                                                                                                                                          edited Jan 14 at 17:56

























                                                                                                                                                                                          answered Jan 11 at 15:14









                                                                                                                                                                                          wooshinyobjectwooshinyobject

                                                                                                                                                                                          1515




                                                                                                                                                                                          1515












                                                                                                                                                                                          • $begingroup$
                                                                                                                                                                                            I suspect you can shorten that to 1 INPUT S$:L=LEN(S$):FOR I=1 TO L:S$=MID$(S$+S$,2,L):PRINT S$:NEXT.
                                                                                                                                                                                            $endgroup$
                                                                                                                                                                                            – Ørjan Johansen
                                                                                                                                                                                            Jan 12 at 2:22










                                                                                                                                                                                          • $begingroup$
                                                                                                                                                                                            @Ørjan Johansen Very nice, thank you.
                                                                                                                                                                                            $endgroup$
                                                                                                                                                                                            – wooshinyobject
                                                                                                                                                                                            Jan 14 at 17:58


















                                                                                                                                                                                          • $begingroup$
                                                                                                                                                                                            I suspect you can shorten that to 1 INPUT S$:L=LEN(S$):FOR I=1 TO L:S$=MID$(S$+S$,2,L):PRINT S$:NEXT.
                                                                                                                                                                                            $endgroup$
                                                                                                                                                                                            – Ørjan Johansen
                                                                                                                                                                                            Jan 12 at 2:22










                                                                                                                                                                                          • $begingroup$
                                                                                                                                                                                            @Ørjan Johansen Very nice, thank you.
                                                                                                                                                                                            $endgroup$
                                                                                                                                                                                            – wooshinyobject
                                                                                                                                                                                            Jan 14 at 17:58
















                                                                                                                                                                                          $begingroup$
                                                                                                                                                                                          I suspect you can shorten that to 1 INPUT S$:L=LEN(S$):FOR I=1 TO L:S$=MID$(S$+S$,2,L):PRINT S$:NEXT.
                                                                                                                                                                                          $endgroup$
                                                                                                                                                                                          – Ørjan Johansen
                                                                                                                                                                                          Jan 12 at 2:22




                                                                                                                                                                                          $begingroup$
                                                                                                                                                                                          I suspect you can shorten that to 1 INPUT S$:L=LEN(S$):FOR I=1 TO L:S$=MID$(S$+S$,2,L):PRINT S$:NEXT.
                                                                                                                                                                                          $endgroup$
                                                                                                                                                                                          – Ørjan Johansen
                                                                                                                                                                                          Jan 12 at 2:22












                                                                                                                                                                                          $begingroup$
                                                                                                                                                                                          @Ørjan Johansen Very nice, thank you.
                                                                                                                                                                                          $endgroup$
                                                                                                                                                                                          – wooshinyobject
                                                                                                                                                                                          Jan 14 at 17:58




                                                                                                                                                                                          $begingroup$
                                                                                                                                                                                          @Ørjan Johansen Very nice, thank you.
                                                                                                                                                                                          $endgroup$
                                                                                                                                                                                          – wooshinyobject
                                                                                                                                                                                          Jan 14 at 17:58











                                                                                                                                                                                          0












                                                                                                                                                                                          $begingroup$


                                                                                                                                                                                          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











                                                                                                                                                                                          $endgroup$


















                                                                                                                                                                                            0












                                                                                                                                                                                            $begingroup$


                                                                                                                                                                                            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











                                                                                                                                                                                            $endgroup$
















                                                                                                                                                                                              0












                                                                                                                                                                                              0








                                                                                                                                                                                              0





                                                                                                                                                                                              $begingroup$


                                                                                                                                                                                              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











                                                                                                                                                                                              $endgroup$




                                                                                                                                                                                              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 '18 at 18:10

























                                                                                                                                                                                              answered Dec 9 '18 at 13:36









                                                                                                                                                                                              ElPedroElPedro

                                                                                                                                                                                              3,4831023




                                                                                                                                                                                              3,4831023























                                                                                                                                                                                                  0












                                                                                                                                                                                                  $begingroup$


                                                                                                                                                                                                  Tcl, 78 bytes



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


                                                                                                                                                                                                  Try it online!






                                                                                                                                                                                                  share|improve this answer









                                                                                                                                                                                                  $endgroup$


















                                                                                                                                                                                                    0












                                                                                                                                                                                                    $begingroup$


                                                                                                                                                                                                    Tcl, 78 bytes



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


                                                                                                                                                                                                    Try it online!






                                                                                                                                                                                                    share|improve this answer









                                                                                                                                                                                                    $endgroup$
















                                                                                                                                                                                                      0












                                                                                                                                                                                                      0








                                                                                                                                                                                                      0





                                                                                                                                                                                                      $begingroup$


                                                                                                                                                                                                      Tcl, 78 bytes



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


                                                                                                                                                                                                      Try it online!






                                                                                                                                                                                                      share|improve this answer









                                                                                                                                                                                                      $endgroup$




                                                                                                                                                                                                      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 '18 at 18:38









                                                                                                                                                                                                      daviddavid

                                                                                                                                                                                                      199111




                                                                                                                                                                                                      199111






















                                                                                                                                                                                                          1 2
                                                                                                                                                                                                          next

















                                                                                                                                                                                                          draft saved

                                                                                                                                                                                                          draft discarded




















































                                                                                                                                                                                                          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).





                                                                                                                                                                                                          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

                                                                                                                                                                                                          Berounka

                                                                                                                                                                                                          Sphinx de Gizeh

                                                                                                                                                                                                          Different font size/position of beamer's navigation symbols template's content depending on regular/plain...