text:
Helloellolloloo Worldorldrldldd
Make a program that takes the word you input, and adds that word to the back of itself minus its first letter, then repeats until all letters are gone.  For example, cat would become catatt, and hello would become helloellolloloo.
Input
Any of the 26 letters of the English alphabet.  There may be multiple words separated by spaces, and the change should be applied to every word.
Output
The word(s) inputted, with each word put after itself with its first letter missing, and then with its second letter missing, and so on until there are no more letters to add.
More examples:
ill eel outputs illlll eelell
laser bat outputs laserasersererr batatt
darth vader outputs dartharthrththh vaderaderdererr
This is code golf, so the shortest code wins.
Clarification:
You can treat the input or output as a list.  You can separate words using newline instead of space.  You can add a trailing space to the input.

honestly, the multiple words thing is kinda annoying. All it does is require a split, apply the function on each word, and then join again. It's also quite debilitating for lots of esolangs which have to check for a space manually

Can I require a trailing space in the input?

sure, you can require a trailing space

Can we take in input as a list of words and output as such?

yes you can Quintec

What length words do you need to handle?

Is it OK for words to be separated by a newline in the output(instead of a space)?

Off topic, but FWIW, this is the exact output you would normally get when you type stuff on the new Macbook, the one with the butterfly keyboard.

Does it need to handle blank input

1. Please update the spec with the new allowances (array I/O, trailing space, etc.) 2. Please inform the existing solutions in case any can save bytes by taking advantage of them.

Can the program take input on separate lines, one word per line?

Can we assume a word is not longer than the range of the native integer?

yes niedzejkob extra character

Hello, Welcome to PPCG! If you want to reply to a question asked by a commenter and ensure they're notified, you can use @. Also, as @Shaggy mentioned, make sure to edit the question with this new information to make sure it's always up-to-date.

@JoKing: so you only want simple puzzles and you're worried that you need 3 bytes more, 1 for splitting, 1 for looping and 1 for joining? Sorry, I implement in C# and I need 200 bytes just for keywords.

You never answered @MickyT's comment, is 9223372036854775807 characters as an upper limit for string length okay?

@BMO I thought there was a meta consensus that you didn't need to worry about reasonable implementation limits, but finding things again on meta is a black art.

Japt -m, 6 3 bytes
Input and output are arrays of words.
£sY

Try it

Explanation
        :For each word in the input array
£       :Map each letter at index Y
 sY     :  Slice the current word from index Y

Thats really compact. Nice!

@qazwsx: Now 50% more compact!

Isn't £ two bytes in UTF-8?

@Vi, I'm not using UTF-8 here.

brainfuck, 60 56 bytes
,[>++++++++[-<----<++++>>]<[>>]<[[<]>.[[-]>[.>]<[<]>]],]

Try it online!
Requires a trailing space and prints a leading space. Both of these could be circumvented, but that ends up at 112 bytes.
Explanation
,[  Loop over each byte of input
  Tape: 32 w o r-32 d'
  >++++++++[-<----<++++>>]   Subtract 32 from the character and add 32 to the previous char
  Tape: 32 w o r d-32 0'
  <[>>]<   If the last character was a space
  Tape: 32 w o r d-32 0'
  or
  Tape: 32 w o r d' space-32
  [
    [<]>.   Move to the end of the word and print out the space
    [   Loop over each letter
      [-]    Remove the first letter (initially space)
      >[.>]  Print the rest of the word
      <[<]>  Move back to the first letter
    ]
    Tape: clear
  ]
,]  Get the next byte of input

Haskell, 36 21 bytes
map$concat.scanr(:)""

Try it online!
Edit: -15 bytes, because of new IO format (list of words instead of space separated words)

You could shave off 5 characters by replacing scanr (:) "" with tails.

@FrerichRaabe: yes, but that would require an import Data.List which adds 17 bytes to the score.

Perl -p, 36 25 23 bytes
s!\b|\S!$'=~s/ .*//r!eg

Try it online!
This is a single regsub. First, it matches all word boundaries or non-space characters:
[][H][e][l][l][o] [][W][o][r][l][d]

Note that each of these matches should be replaced with the rest of the word:
[→Hello][H→ello][e→llo][l→lo][l→o][o→] (...)

We can accomplish this with the special variable $', which stores the part of the string after the match. However, we need to apply the nested regsub s/ .*// to it, which removes everything past the first space in $', in order to get rid of the remaining words in the input.
Thanks to @nwellnhof for 2 bytes.

You can replace [^ ] with \S.

Python 3, 49 bytes
d=lambda s:' '.join(n+d(n[1:])for n in s.split())

Try It Online!
This takes advantage of the fact that "".split() returns an empty array so that acts as the check for the base case in the recursion.

Jelly, 3 bytes
ḊƬ€

Try it online!
Don’t need the Ks anymore since array input/output is now allowed.
ḊƬ€
  €   For each word:
Ḋ       Remove the first letter
 Ƭ      until there are none left.

I think you need ḊƬẎ) (or ḊƬF), if you prefer).

@EriktheOutgolfer I don't think so. Each word is represented by a separate array in the output

I'm not sure if you can claim that, since the arrays are nested, and nothing is specified in the question to allow it.

JavaScript (ES6), 33 bytes
Saved 1 byte thanks to @ShieruAsakoto
I/O format: array of words.
a=>a.map(g=w=>w&&w+g(w.slice(1)))

Try it online!

JavaScript (ES6), 35 bytes
I/O format: array of words.
a=>a.map(w=>w.replace(/./g,"$&$'"))

Try it online!

44: s=>s.replace(/\S+/g,g=s=>s&&s+g(s.slice(1)))

Thanks for my "something new" for today; never knew about $' (or $<backtick>).

APL(Dyalog), 19 9 bytes
{⌽∊,\⌽⍵}¨
thanks to @H.PWiz for jogging my brain
This works because all strings in APL are character arrays.
{⌽∊,\⌽⍵}¨
        ¨ - for each string
      ⍵} - string argument - ex. "hello"
     ⌽ - reverse - "olleh"
   ,\ - scan magic - "o" "ol" "oll" "olle" "olleh"
  ∊ - enlist(join together) "oolollolleolleh"
{⌽ - reverse - "helloellolloloo"

TIO

R,  82 75 67 bytes
write(sapply(x<-scan(,""),substring,1:(y=max(nchar(x))),y),1,y,,"")

Try it online!
Several bytes saved thanks to JayCe
Separates output with newlines.
The sapply(...) expression generates a matrix/column vector of the appropriate substrings, padding with "" as needed. write then prints the elements of the matrix, y per line, separating them with "".

Golfed a different approach while holding a sleepy baby; will add an explanation later.

If the length of the words are restricted, eg 99 chars or ~1e6 then you can knock of a bunch of bytes with ...substring,1:1e6,1e6)... or similar

If you can separate words by a newline: tio. I have asked this in a comment. Can work with@MickyT ‘s comment

@JayCe looks like that could be 67 bytes before incorporating MickyT's suggestion

brainfuck, 94 93 bytes
-[-[-<]>>+<]>-<<+[[[-]<,[->+>+<<]>[-<+>]>>[-<->>+<]<]<<[>>+<<[-]]<[<]>[[.>]<[<]>[-]>]>>>>.<<]

Try it online!

Saved one byte thanks to Nitrodon -- golfing .[-]>[.>]<[<]> to [.>]<[<]>[-]>.

Explanation
[[[ (dynamic) tape layout: ... NUL STR ... STR CHR FLG BUF SPC NUL ... ]]]

load a 32 into SPC
-[-[-<]>>+<]>-

while FLG
<<+[

 read a word
 [
  clear FLG; read CHR
  [-]<,
  copy CHR to BUF (using FLG as a temporary)
  [->+>+<<]>[-<+>]
  subtract SPC from BUF and save SPC
  >>[-<->>+<]
  move tape layout one to the right
  <
 ]

 strip trailing space; set FLG to true
 << [>>+<<[-]]
 to STR's first character
 <[<]>
 print word in all reduced forms
 [
  [.>]<[<]>[-]>
 ]

 print SPC; move to FLG
 >>>>.<<
]

Try it online!
Attribution
Esolang's brainfuck constant collection was used for the initial space load.

This doesn't seem to terminate. Is that intended?

@JoKing Yes. In certain implementations it would exceed the tape limit, exiting by error.

Husk, 6 4 bytes
-2 bytes thanks to Jonathan Allan (taking input as a list)!
moΣṫ

Try it online!
Explanation
Takes input as a list of strings and maps the following function:
Σṫ  -- example argument: "abc"
 ṫ  -- tails: ["abc","bc","c"]
Σ   -- concat: "abcbcc"

The split & join are possibly no longer required, currently such specification is in a comment.

05AB1E, 5 bytes
€.síJ

Try it online!
Explanation
€.s        # push suffixes of each
   í       # reverse each
    J      # join suffixes

Boring 5-bytes alternative: í€ηJí (since prefixes is a 1-byte builtin instead of 2-bytes like suffixes; still requires an additional reverse-each however at the start however, so the byte-count remains 5).

Retina 0.8.2, 15 bytes

¶
.
$&$%'
¶

Try it online! Note: trailing spaces. Explanation:

¶

Split on spaces.
.
$&$%'

Append its suffix to each letter. The % means that we only get the word's suffix.
¶

Join with spaces.

Vim, 47 bytes (38 key strokes)
Start with your input as the sole line in a Vim buffer.
:s/<Space>/\r/g<CR>ggqaywPlxqqb99@aj0q99@bgg99J

Explanation
This puts each word on its own line, iterates over each line, then rejoins them all. Breaks if words are longer than 99 characters or if your input has more than 99 words.

:s/<Space>/\r/g<CR> replaces spaces with new lines (\r)
gg positions the cursor at the beginning of the first line
qa begins recording macro a:

yw yanks the rest of the word
P puts it behind the cursor
lx removes the first letter of the latter word
q stops recording macro a

qb begins recording macro b:

99@a executes macro a ninety-nine times (introduces the character limit)
j0 positions the cursor at the start of the next line
q stops recording macro b

99@b executes macro b ninety-nine times (introduces the word limit)
gg positions the cursor at the first line
99J joins the following ninety-nine lines with spaces (word limit again)

For another 2 bytes (2 key strokes) you could extend the word limit to 999. Another 4 bytes, 9999, etc.

Pepe, 167 153 bytes
REEerEeeEeeeeeRrEEEEerEEEEEeerEErEEeerreErEEeErreEREEEEEEEreereErEerEEEErEEeerrEEreRRErEEEEreREEreeereReeRerEEEEEErEEEeerreEerEEeerEEEEerEEeEreereErEeree

Try it online!

16-bit x86 assembly code, 24 bytes
     47             inc    di
     B020           mov    al,20h
l1:  3806           cmp    [si],al
     7212           jb     l5 ;less means end of string
     7401           je     l2  ;equal means space was seen
     4F             dec    di ;overwrite extra space
l2:  E80300         call   l3
     46             inc    si ;move to next character in word
     75F1           jne    l1
l3:  56             push   si
l4:  3806           cmp    [si],al
     A4             movsb      ;copy character
     77FB           ja     l4  ;until either zero or space is seen
     5E             pop    si
l5:  C3             ret
Call with si = pointer to source string, di = pointer to output buffer.
The source string requires a zero byte to end it.
The code is the same in 16- or 32- or 64-bit (si/di become either esi/edi or rsi/rdi).
32-bit code is two bytes larger because of the expanded call.
64-bit code is three bytes larger still because the inc/dec of rsi/rdi attracts a prefix (but if it is known that they are within 32-bit memory space, then they can be esi/edi again to avoid that penalty).

MATL, 18 16 bytes
"@gXH"HX@Jh)]0&h

Input is a cell array of words. Try it online!
Explanation
"         % Implicit input: cell array of strings. For each cell
  @g      %   Push content of current cell, that is, a word
  XH      %   Copy into clipboard H
  "       %   For each letter
    H     %     Push word
    X@    %     Push iteration index
    Jh)   %     Index from that until the end into current word
  ]       %   End
  0       %   Push 0. Will be cast to char. Char(0) is displayed as space
  &h      %   Concatenate horizontally all elements so far. Implicit display

K4 / K (oK), 9 bytes
Solution:
,/'(1_)\'

Try it online!
Explanation:
,/'(1_)\' / the solution
        ' / apply to each
       \  / scan
   (  )   / do this together
    1_    / drop first
,/'       / flatten (,/) each (')

C++ (clang), 174 bytes
#include<map>
#include<string.h>
std::string r(std::string w){while(auto x=strchr(w.c_str(),32))return r(w.substr(0,x-w.c_str()))+" "+r(x+1);return w!=""?w+r(w.substr(1)):w;}

Try it online!
It's my first submission, and i didn't know if returning string instead of printing it is okay :)

Welcome to PPCG! Yes, returning a string is okay. Hope you stick around!

You could use the inequality operator's symmetry to remove a space and thus save a byte -- return w!=""? can be return""!=w?.

Stax, 3 bytes
m|]

Run and debug it
Explanation:
m   Map over the lines
 |] Get all suffixes (suffices?)
    Implicit flatten and output

Regarding suffices: https://en.wiktionary.org/wiki/suffices#Etymology_2

Vyxal, 5 bytes
ƛ[Ḣx+

Try it Online!
(IMO) this is a really neat recursive solution. Port of my JS answer that came out really nicely.
ƛ     # Foreach value as n
 [    # If truthy (Not empty string)
   x  # Call this function (The function we're mapping with)
  Ḣ   # With n[1:] - remove first character
    + # Appended to the result

The "concatenation of suffixes" approach doesn't do any better:
Vyxal, 5 bytes
ƛṘ¦∑Ṙ

Try it Online!
ƛ     # Map...
 Ṙ    # Reverse
  ¦   # Cumulative sums (prefixes)
   ∑  # Concatenated
    Ṙ # Reversed

Charcoal, 14 bytes
⪫Ｅ⪪Ｓ ⭆ι✂ιμＬι¹

Try it online! Note: Trailing space. Link is to verbose version of code. Explanation:
   Ｓ            Input string
  ⪪             Split on spaces
 Ｅ              Map over each word
      ι         Current word
     ⭆          Map over each character and join
        ι       Current word
         μ      Current index
           ι    Current word
          Ｌ     Length
            ¹   Literal 1
       ✂        Slice
⪫               Join with spaces
                Implicitly print

Pip -s, 11 bytes
J_@>,#_Mq^s

Takes the space-separated list of words from stdin. Try it online!
Explanation
             s is space (implicit)
        q    Read a line of stdin
         ^s  Split it on spaces
       M     Map this lambda function to each word:
 _            The word...
  @>          sliced starting at index...
    ,#_       range(len(word))
              This creates len(word) slices ["word" "ord" "rd" "d"]
J             Join those into a single string
             The resulting list of modified words is printed; the -s flag uses space
             as the separator

Python 2, 63 bytes
lambda s:' '.join(map(g,s.split()))
g=lambda s:s and s+g(s[1:])

Try it online!

It is 64 bytes on my computer, mac OS.

Canvas, 6 bytes
±［±］⇵］

Try it here!
5 bytes with a crazy output format

C#, 111 90 bytes
b=>string.Join(" ",(b.Split(' ').Select(x=>string.Concat(x.Select((y, i)=>x.Substring(i))))))

Try it Online!
By Changing input and output to arrays, I saved a few bytes:
b=>b.Select(x=>string.Concat(x.Select((y,i)=>x.Substring(i)))).ToArray()

Try it Online!

Lua, 70 bytes
for i=1,#arg do x=arg[i]for i=1,#x do io.write(x:sub(i))end print()end

Try it online!
Explanation
The arguments in Lua are stored in the table arg starting at index 1. The unary operator # returns the size of the table and function s:sub(a,b) returns a substring
based on string s delimited by integers a and b, if b is not passed it will return the rest of the string.
I had to use io.write() instead of print() to avoid line breaking, and added print() at the end for the opposite reason.

K (oK), 17 13 bytes
{,/|:'|,\|x}'

Try it online!
Prefix anonymous function; Input is taken as a list of strings, which in turn are lists of characters.
Thanks @streetster for 4 bytes.
How:
{,/|:'|,\|x}' //Main function, argument x → ("ill";"eel")
            ' // For each element of the argument
         |x}  // Flip it. x → ("lli";"lee")
       ,\     // Concatenate each element, keeping intermediates. x → (("l";"ll";"lli");("l";"le";"lee")
      |       // Flip it again. x → (("lli";"ll";"l");("lee";"le";"l"))
   |:'        // Now flip each element. x → (("ill";"ll";"l");("eel";"el";"l"))
{,/           // Concatenation scan. x → ("illlll";"eelell")

You can return a list, also take a look at my oK solution

@streetster oh, nice. I'm still in the process of learning K, so my solutions won't be as short or as elegant as I'd like. Thanks for the heads up!

Flatten before reverse allows you to omit the "reverse-each", bringing it down to 10 bytes:  {|,/,\|x}'

Common Lisp, 179 bytes
(defun r(s)(cond((endp s)nil)((eql(first s)#\Space)(princ " ")(r(rest s)))(t(q s)(r(rest s)))))(defun q (l)(cond((eql(first l)#\Space)t)((endp l)t)(t(princ(first l))(q(rest l)))))

Try it online!
This is my first try at golfing any edits are welcome

Hello and welcome to PPCG. Removing whitespace can save you 29 bytes.

@Johnathan Frech thanks i just updated with no spaces

I think you missed four superfluous spaces.

You can most likely also use car instead of first and cdr instead of rest to further golf your submission.

Na, im good with it now haha, maybe ill come back and mess with it later. Im just learning lisp now my teacher said to never use car and cdr so they were out of my head while i was doing it

Well, one has not truly done list processing without using these two primitives. :P

(1) you can use eql instead of equal, even eq seems to work in TIO. (2) The (r(coerce "hello world" 'list)) is testing, not part of the byte count. (Testing is usually put in the TIO footer section.)

Oh, I also think nil is redundant.

I just edited, i thought eql would test reference thats why i had equal but eql works

Python 3, 79 74 bytes
-5 bytes thanks to mypetlion
print(*map(lambda x:''.join(x[n:]for n in range(len(x))),input().split()))

Try it online!
A full program that takes input from stdin and outputs to stdout.

print(*map(lambda x:''.join(x[n:]for n in range(len(x))),input().split())) Full program to save 5 bytes.

Perl 6, 44 32 bytes
-12 bytes thanks to nwellnhof!
~*.words>>.&{[~] $_,{S/.//}...0}

Try it online!
An anonymous Whatever lambda that takes a string and returns a string.
Explanation:
 *.words   # Split the given word by spaces
        >>.&{                  }  # Map each word to
                           ...  # A list composed of
                 $_              # The initial string
                   ,{S/.//}      # Remove the first character
                              0  # Until it's empty
             [~]   # All joined together
~   # Convert the list to a string, which joins by spaces

29 bytes

@nwellnhof I can't believe I forgot about .words!

C (gcc), 79 bytes
f(s,t)char*s,*t;{for(;*s;printf("%.*s",*s^32?t?t-s:~0:1,s),s++)t=strchr(s,32);}

Try it online!

Ruby, 42 bytes
->s{s.map{|a|(w=a.b).chars{a[0]='';w<<a}}}

Try it online!

JavaScript (Node.js), 33 bytes
s=>s.replace(/\B(?=(\S+))/g,"$1")

Try it online!
I don't really know JavaScript, but I just copied Arnauld's syntax with an idea I had for the regex substitution :P

MathGolf, 6 bytes
ÆÅ_╞↑

Try it online!
Outputs a trailing space, though you can add another byte to remove this.
Hopefully 6 bytes when implicit input is implemented. Yay.
Explanation:
        Implicit input
Æ       Implicit for loop over the next 5 instructions
 Å  ↑   While true without popping (empty string is false)
  _╞    Duplicate the top of stack and remove the first letter
        (space) Append a space to the stack
        Implicitly output the stack joined together

I can confirm that ÆÅ_╞↑  works in the latest version of MathGolf, with input ['Hello','world']. It is to be pushed today. I've worked on getting typed input and implicit input working properly, and now I can run the program above with correct output.

Java (JDK 10), 90 bytes
s->{var r="";for(var x:s){for(int i=0;i<x.length();)r+=x.substring(i++);r+=" ";}return r;}

Try it online!
Credits

-11 bytes thanks to Kevin Cruijssen, notifying me of the rule change about the input.

s.split(" ") can be just s. The rules have been changes, so you can take a String-array as input. (I also tried modifying the input array so you can remove the return-statement, but it seems to be longer.)

Powershell, 29 23 bytes
Port of Javascript by @Arnauld
$args-replace'.',"$&$'"

Input and output are a list of word. Test script:
$f = {

$args-replace'.',"$&$'"

}

@(
    ,('illlll eelell', 'ill','eel')
    ,('laserasersererr batatt', 'laser','bat')
    ,('dartharthrththh vaderaderdererr', 'darth','vader')
) | % {
    $e,$s = $_
    $r = &$f @s
    $r = "$r"
    "$($r-eq$e): $r"
}

Output:
True: illlll eelell
True: laserasersererr batatt
True: dartharthrththh vaderaderdererr

Scala, 97 bytes
Scala main that takes a single String argument containing all the words.
args(0).split(" ").foreach(x=>{for(i<-0 to x.length)print(x.substring(i,x.length));print(" ")})
Try it online!

That's actually 95 bytes, if you remove the unnecessary newlines.

Python3, 86 bytes
Reduced a lot, thanks to @ElPedro and @manatwork
def f(a):return a+f(a[1:])if''<a else''
for x in input().split():print(f(x),end=' ')

P.S. I tried removing split but then nothing is printing, its probably required in python3

The question asks for multiple words. Also, you should include your bytecount in the answer

oh my bad will correct it

Welcome to PPCG! You can use tryitonline to format your answer nicely and allow people to test it. See my answer as an example.

And TIO has a character counter too, which will say your solution currently has “106 chars, 106 bytes (UTF-8)”. BTW, unfortunately your code have a small glitch as for “cat” outputs “catat”, not “catatt”. Just change the condition to len(a)>0. Or to a>'' as it is shorter. Or to ''<a as that way you need no space between the if keyword and the expression. See Tips for golfing in Python.

You don't need the space in the split(). Python splits on space by default. You can also remove the space in return '' to save another one.

You also don't need the newline and two spaces before return a+f(a[1:]). It can go on the same line as the if. With these and the hints from @manatwork you should be well below 100 :-)

Don't remove the whole split - just the space in it. Try this link

You can also replace the if and 2 returns with return a+f(a[1:])if''<a else'' which can then go on the same line as def f(a) taking it down to 87 bytes

Python3, 58 bytes
Takes a space-separated string of words from stdin and returns stdout likewise.
f=lambda x:x and x+f(x[1:])
print(*map(f,input().split()))

It works by splitting the string into a list of words and using map() to call the recursive function f on each element. Honestly, I don't know exactly how f works. When the stack reaches the end of the word, x becomes the empty string (''), so the and statement returns False, which I suspect acts as the base case to end recursion.
Here's the same idea but without the functional aspects:
def f(x):
    return x and x + f(x[1:])

print(*( f(word) for word in input().split() ))

q 78 38 bytes
" "sv{r::x;{x,r::1_r}/[count x;x]}each

Welcome to PPCG! You can take input as a list of lines and return a list of lines rather than having to use vs and sv to split on whitespace.

Oh right, I thought the multiple words necessitated a string split, I`ll give it another go, thank you

Also... take a look at the scan operator rather than recursing.

... was thinking along the lines of { raze {1_x} scan x } each which can be golfed down a little more...

Used 'over' instead with some recursion, need to find a way to do it without globals

" "sv{raze{1_x}scan x}each, your one, comes out to 26, gonna be hard to beat that

raze@'((1_)\)@' for 15 bytes :)

@streetster raze@'(1_)\' should work too

@ngn raze@'((1_)\') works for 14 bytes, need the brackets else q complains about the naked . Can also do (,/')((1_)\') for 13.

Attache, 28 bytes
Join&sp##Sum@Suffixes=>Split

Try it online!
Alternatives
ReplaceF&(Sum@Suffixes)&/"\\w+"               ?? 31 bytes
ReplaceF«_,/"\\w+",Sum@Suffixes»              ?? 34 bytes, 32 chars
ReplaceF<~_,/"\\w+",Sum@Suffixes~>            ?? 34 bytes

Explanation
Join&sp##Sum@Suffixes=>Split    input, e.g.: "abc defg"
                       Split    split the input on spaces
                                e.g.: ["abc", "defg"]
                     =>         on each word:
                                  e.g.: "abc"
             Suffixes             take the suffixes of that word
                                  e.g.: ["abc", "bc", "c"]
         Sum@                     join them together
                                  e.g.: "abcbcc"
       ##                       then
Join&                           join the result by:
     sp                           spaces

Scala, 81 bytes
def e(s:List[String])=s.map(_.foldRight(("","")){(a,b)=>(a+b._1,a+b._1+b._2)}._2)

Try it online!
As per comments, this can receive and output a List[String]. This builds the output from right to left, starting with the rightmost letter, then prepending the two rightmost letters, and so on down the line.

Pyth, 8 6 bytes
m_s.__

Decreased byte(s?) thanks to @Steven H.
Try it online! Input and output are a list.
Expalanation:
        - implicit output
m       - map function d:
      _ -   ...d reversed...
    ._  -   ...get all prefixes of it...
  _s    -   ...joined and reversed
        - ...over implicit Q (input)

You can save a byte by using m instead of V, since that would make the Q implicit rather than explicit.

Pascal (FPC), 129 bytes
var s:string;i,j:int32;begin read(s);repeat j:=Pos(' ',s);for i:=1to j do write(s[i..j-1]);write(' ');Delete(s,1,j)until s=''end.

Try it online!
Requires that the input ends in space, allowed in this comment.

Twig, 73 bytes
Creates a macro with the function f() that receives an array of words, displaying the words separated by new lines.
{%macro f(a)%}{%for v in a%}{%for i in 0..v|length%}{{v[i:]}}{%endfor%}
{%endfor%}{%endmacro%}

To use it, just import:
{% import 'macro.twig' as a %}

{{ a.f(['a','sentence','is','a','list','of','words']) }}

{# to pass a string, you can split it #}
{{ a.f('a sentence is a list of words'|split(' ')) }}

You can try it on https://twigfiddle.com/8xech1
Warning: due to the way that output is handled in the link, I was forced to add a simple period (.) at the end of the line. This is NOT needed for normal operation.

Haskell, 24 bytes
This solution is not optimal in two ways: 1) the other Haskell answer by nimi is 3 bytes shorter and 2) the input is limited to 9223372036854775807 characters (~36 exabytes), though I think it's an interesting find:
map.mconcat$drop<$>[0..]

Try it online! (sets a limit of 255 characters for TIO would time out otherwise)
Explanation
Since drop has type Int -> [a] -> [a] it forces [0..] to be [0..9223372036854775807] which is finite and thus the program terminates (eventually).
And mconcat takes the list of [drop 0, drop 1..] and gives us a function String -> String which is equivalent to:
\str-> drop 0 str ++ drop 1 str ++ .. ++ drop 9223372036854775807 str

Note: Once the argument of drop is greater or equal to the length of str it just appends empty strings.
Practical solution, 40 bytes
This won't take as long as the shorter solution but at a great cost of 16 bytes:
map$mconcat=<<map drop.zipWith pure[0..]

Try it online!

C#, 193 166 bytes
class a{static void Main(string[]b){foreach(var c in b)d(c,0);}static void d(string c,int e){if(e==c.Length)Console.Write(" ");else{Console.Write(c[e++..]);d(c,e);}}}

Try it Online!
Since .NET automatically splits the arguments at spaces, it's possible to loop over them without splitting them manually.
Other than that, this uses recursion to subtract one character at a time using the overload of string.Substring that takes only 1 argument which is the index to start at.

Brachylog, 7 bytes
{a₁ᶠc}ᵐ

Try it online!
Explanation
{    }ᵐ          Map for each word:
 a₁ᶠ               Find all suffixes
    c              Concatenate into a single string

Burlesque, 8 bytes
{iS\[}ww

Try it online!
{
 iS # All suffixes
 \[ # Concatenate
}ww # For each word

APOL, 23 bytes
ƒ(s(i) j(ƒ(∋ V(⋒ ∈)))))
Explanation
ƒ(         List-builder for loop
  s(       String-split instruction (splits at spaces by default)
    i      Input
  )
  j(       String join instruction
    ƒ(     List-builder for loop
      ∋    For item (the current word being processed)
      V(   Substring instruction
        ⋒  For iterator (the thing the current for loop is iterating through, in this case the current word)
        ∈  For counter
      )
    )
  )
)

Given a quick read of the esolangs page (https://esolangs.org/wiki/APOL) and the corresponding interpreter, I do not think you can claim a score of 23 bytes. I do not see any implementation of an appropriate custom code page, which means the program actually deals with unicode characters. Correct me if I'm wrong, and somehow have missed this implementation detail, but it seems this would actually be 31 bytes. For reference, Jelly implements such a custom codepage, which you can read on here: https://github.com/DennisMitchell/jellylanguage/blob/master/jelly/interpreter.py

@ConorO'Brien I'm unsure how to do this. Could you explain how to do this?

Sure. The reason why golfing languages can claim scores like that is because they have the ability to actually read the bytes of a file, and associate those bytes with particular characters. So, your interpreter has to be able to read a file of bytes, and index them into your desired unicode string, and then you can proceed as normal. Here's an example that should help: https://gist.github.com/ConorOBrien-Foxx/0b5c41012830279b5ba109d9f60aec4f . Note that you want to generate the raw file, e.g., with with open("sample.txt","wb") as f: f.write(b"\x10\x11").

You probably also want to have a way to convert your unicode to the byte values for ease of access of testing. Probably best done with command line arguments or perhaps as a REPL command

@ConorO'Brien Okay, I've done it.

Mathematica (Wolfram Language): 71 Characters
(a=Characters@#;StringJoin@Array[a[[#;;]] &,Length@a])&/@StringSplit[#]&

TIO Link
There pretty much has to be a better solution than this, but it works.
Explanation:
Takes a string and splits on spaces/newlines/punctuation, then iterates over this list. Finds a list of characters of each "word", then uses the Array to take all the elements, then all but the first, and so on. Then, these are joined (taking advantage of the fact that StringJoin ignores nested lists) and the function moves to the next word.

C (gcc), 94 bytes
f(char*s){char*e=s+strlen(s),*i=s;for(;i<e;*i++=*i-32?*i:0);for(i=s;i<e;i++)printf(*i?i:" ");}

Try it online!
Saves a pointer to the end of the string in char *e, then replaces spaces with null characters, then prints the string starting with each character and ending at the next null character, but printing a space if the current character is a null character.

JavaScript (Node.js), 88 bytes
f=s=>s.split(' ').map(e=>[...e].map((_,i,a)=>a.slice(i,a.length).join``).join``).join` `

Try it online!

By using flatMap you would save a join.

Welcome to PPCG.

@tsh throws error: flatMap is not a function
https://tio.run/##XcgxDsMgDEDRq7BhpNQ3gLlL5w5VVSxiUiIXo4B6fZq509f7O32pp6O0cam68pzZdx869iZlgDXW4YcasA8PROQnZqFxOw@8lrKQ84GwS0kMp1C4buPtcNdSY/yriTNp7SqMohtksFcWUXPXQ1br3PwB

C (gcc), 64 bytes
f(s,t)char*s,*t;{for(;*s;t+=*s<33)for(strcpy(t,s++);*t&31;t++);}

Take two char* parameters: The first one for input, and the second one for output. The caller is responsible for malloc and free. Like most string functions in C, this one is designed to be vulnerable by overflow the buffer.
Try it online!

Gema, 24 characters
<L>=@x{$0}
x:?*=?*@x{$2}

Sample run:
bash-4.4$ gema '<L>=@x{$0};x:?*=?*@x{$2}' <<< 'darth vader'
dartharthrththh vaderaderdererr

I assume it's the same amount of bytes, unless there's multi-byte characters in there?

Definitely the same. Gema doesn't use multi-byte characters.

Okay. It was just strange that you used the term characters in the header

Red, 67 66 bytes
func[s][foreach w split s" "[until[prin w take w tail? w]prin" "]]

Try it online!

Kotlin, 87 bytes
fun f(s:String):String=if(s=="")s else s.split(" ").joinToString(" "){it+f(it.drop(1))}

Hello and welcome to PPCG; nice first post. You could add a link to an online implementation (like TIO) for ease of verifying your solution.

Python 2, 55 bytes
for x in input():
 y=""
 while x:y+=x;x=x[1:]
 print y,

Try it online!
Takes input as a list. output is separated by spaces.

Scala, 81 bytes
def x(l:String):String=if(l=="")" "else l+x(l.tail)
println(args.map(x).mkString)

Try it online!

Taking input as a predefined variable is not allowed. That would turn the submission into a snippet. Submissions should either be a full program or a function.

Hello, @JoKing, thanks. I updated the answer. Does this follow the rules now?

If you're submitting ot as a full program, I'm afraid you're going to have to include the boilerplate as well

Elixir, 122 bytes
a = ["Hello","World"]
f = fn n,f -> if(n != "") do "#{n}#{f.(String.slice(n, 1..-1), f)}" end end
Enum.map(a, &(f.(&1,f)))

# OUTPUT
["Helloellolloloo", "Worldorldrldldd"]

Try it online!

Hi, welcome to PPCG! The input doesn't have to be in the actual code, so you can declare the list in the input section, and reference it by a single letter variable.

@AlexGrigore Actually, taking input as a predefined variable is not allowed. That would turn the submission into a snippet. Submissions should either be a full program or a function.

The input shouldn't be hard-coded, but passed to the program/function. You can see what IO methods are allowed here.

Java, 131 bytes
char[]e(char[]a){int b=0,l=a.length,c,d=0;char[]n=new char[l*(l+1)/2];for(;b<l;b++){for(c=l-b;c>0;c--){n[d]=a[l-c];d++;}}return n;}

I know there is a better Java answer but, wanted to do it just with char arrays
char[] e(char[]a){
    int b=0,l=a.length,c,d=0;      //l to keep length, b for each iteration, c for each letter in iteration
    char[] n= new char[l*(l+1)/2]; //Create new array with length based in triangular number sequence
    for(;b<l;b++) {
        for(c=l-b;c>0;c--) {
            n[d]=a[l-c];          //Fill it
            d++;                   //d keeps position in new array
        }
    }
    return n;
}

l+1 can most likely be -~l.

Julia 0.7, 75 65 bytes
p(a)=for i in a for j=1:endof(i) print(i[j:end])end;print(" ")end

Try it online!
First codegolf. Yay
v0.7 becase it it just deprecates the endof method and 1.0 replaces it with lastindex.
Update: As mentioned in the comments I am not sure if an array of words as input is permitted. So I included the bytes to take a string as input
Update2: Apparently an array of strings is ok so here we go down to 65 bytes. Thx to @JonathanFrech for removing some more whitespace

I do not think taking a string array is valid. Please reflect splitting in your byte count.

@JonathanFrech Yeah I'm not sure too. I just added the 7 more bytes to take a String as the argument.

You can remove some whitespace.

@JonathanFrech oh thanks didn't know that you don't need the white spaces after). In the comments of the golf somebody asked if a list of words would be alright. And the author permitted that. One could argue that an array of words could count as a list. So my first answer would be alright.

@johnathan Actually the OP has commented that taking/returning a list of words is valid

@JoKing nice I will update my answer tomorrow when I'm on my pc again

Kotlin, 48 bytes
Lambda takes a List<String> as input and returns a List<String> as output, which is allowed. The extra code in the footer is just so the input can be tested easily.
{it.map{it.indices.fold(""){a,v->a+it.drop(v)}}}

Try it online!

GolfScript, 23 bytes
" "/{{""=!}{(;}/}/]" "*

Try it online!

Multi User Forth(121 bytes), Protomuck variant.
" " explode_array { swap foreach nip { swap  begin dup 1 strcut nip dup not until }cat repeat }list " " array_join .tell

I guess if you want to require that I use entirely standard stuff, then .tell it becomes me @ swap notify which brings it up to 132 bytes. If you want to go the other direction, then I guess that swap could become .s and nip .n, dup .d etc, would turn it into
" " explode_array { .s foreach .n { .s  begin .d 1 strcut .n .d not until }cat repeat }list " " array_join .tell

Which has 113 bytes.
Luckily we can continue further, begin turns into .b, until .u and explode_array .e, if we use our thinking caps we can turn foreach into .f by defining that into foreach nip (who needs the index of the array anyway?) and we end at 94 bytes.
" " .e { .s .f { .s  begin .d 1 strcut .n .d not until }cat repeat }list " " array_join .tell

But, this is getting silly, and probably only hurting any chance of this being seen as a meaningful first post on codegolf.

C (clang), -DT=t=strtok -DZ=" ") 178 113 106 105 95 91 bytes
i;f(*a){char*t;for(T(a,Z;t;printf(Z,T(0,Z)for(i=0;t[i];)printf(t+i++);}

Try it online!

This will potentially fail on input longer than $99$ bytes. This is not a platform limitation, but your choice. I do not know if this is a valid answer.

@JonathanFrech but a dynamically growing array to store input would be much longer code. The only other solution would be passing the input as an argument to the function.

Cool that that is also shorter; as I said -- I do not know if the other is invalid; only that it seemed a bit unelegant.

Suggest T(i=0,Z)for(; instead of T(0,Z)for(i=0;

Kotlin Android, 204 bytes
fun f(s:String){ val a=s.split(" ".toRegex()).dropLastWhile{it.isEmpty()}.toTypedArray();for(i in a.indices){var t=0;while(t<a[i].length){for(j in t until a[i].length){print(a[i][j]+"")};t++};print(" ")}

}
Try online
This Program is written in Kotlin Android.

@Keeta, Thank you for your Update.

Input should not be taken as a predefined variable otherwise this becomes a snippet. Submissions should be a full program or a function equivilant.

Updated my code.

Err, the program should take the word as input, not jard code "hello world"

Updated my code.

sed, 42 37+2 bytes
s:\b:_:g
:A
s:_(.(\w*_))|__:\1\2:g
tA

Try it online!
Repeatedly match parts of words between underscores:
_hello_ _world_
hello_ello_ world_orld_
helloello_llo_ worldorld_rld_
helloellollo_lo_ worldorldrld_ld_
helloellollolo_o_ worldorldrldld_d_
helloellolloloo__ worldorldrldldd__
helloellolloloo worldorldrldldd

Javascript(ES6), 34 bytes
s=>s.map(k=x=>x?x+k(x.slice(1)):x)

Try it online!
Takes input as array of words, returns array of words.
Aaah, the power of recursion...

JavaScript (V8), 46 42 bytes
-4 thanks to Redwolf
w=>w.split` `.map(f=a=>a&&a+f(a.slice(1)))

Try it online!

-2: d=w=>w.split\ `.map(f=a=>a&&a+f(a.slice(1)))(and then you don't need to do thed=` according to site rules, so another -2)

BQN, 4 bytes
∾∘↓¨

Anonymous tacit function that takes and returns a list of strings. Run it online!
Explanation
∾∘↓¨
   ¨  For each element of the list:
  ↓     Get a list of its suffixes
 ∘      and
∾       join them into one string

Thunno 2 Ṡ, 3 bytes
€ṣṃ

Attempt This Online!
Input as a list of words. Output as a single string.
Explanation
€ṣṃ  # Implicit input
€ṣ   # Suffixes of each string in the list
  ṃ  # Reverse each inner list
     # Implicit output, joined

Factor + grouping.extras, 46 bytes
[ " "split [ tail-clump concat ] map " "join ]

Try it online!

sed, 52 bytes
s/[a-z]+/@&/g
:l
s/@([a-z]([a-z]+))/\1@\2/
tl
s/@//g

Try it online!


text:
Get the lowest possible pylint score within 128 bytes of python
pylint has no lower bound on the scores it will give your code. It uses the following metric to score code, with the maximum score being 10:
10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)

With python 3.6, try and write a program that:

Outputs "Hello World" when run from the command line (i.e. python script.py), and no other output.
Gets the lowest possible score from pylint, with default settings (i.e. pylint script.py)
Is strictly less than or equal to 128 bytes in size.

I suggest to change the title to Python 3.6 instead of python to improve challenge scope clarity.

-5430
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++exit("Hello World")

Try it online!

-3330.00 -3540.00

Lost 210 points thanks to Dennis -- exiting with the required string instead of printing it.

exit("Hello World"
)>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_

Try it online!

-3330 is the score with a trailing newline, which puts the byte count at 129. The missing final newline decreases the score to -3340.

-3540

@Dennis Did not know pylint penalizes you for the trailing new line; thanks for the improvement.

-840.0
print("Hello World"),0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0

Try it online!
0<0 seems to be pretty good, for a score of -30 points per each occurrence.

-335.0
126 bytes
print("Hello World");import os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os

Could you not squeeze another ,os in there? Or are the two trailing spaces necessary for your score?

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Transpile Brainstract to Brainfuck
Introduction
Brainstract, a newly created dialect of Brainfuck adds a bit more elements to the syntax. In addition to the normal Brainfuck syntax, there are macros. To define a macro:
{macro_name ++++}

Then use it:
{macro_name} Adds 4 to the current cell

Challenge
Your challenge is to take a valid Brainstract program as input (command-line-arguments, function arguments, STDIN or file), and output a valid Brainfuck program that is equivalent to the Brainstract program (non-brainfuck characters are allowed in output). You may assume all input will be valid Brainstract.
Brainstract Spec
Whitespace counts as ANY whitespace (tabs, spaces, etc.)
A macro is defined by an opening brace character ({) followed by a macro name which must be made up of any characters except whitespace, brainfuck, and Brainstract characters (anything except whitespace and {}[]<>+-.,)
Then, it is followed by any amount of whitespace and a macro definition, made up of macro calls and non-brace characters and finally the macro is closed off with a closing brace (})
A macro call is of the form {macro_name} where macro name is the same as above.

Examples
Format: Input -> Output
{cat ,.} {cat}{cat}{cat}            -> ,.,.,.
{add [>+<-]} ++++>+<{add}           -> ++++>+<[>+<-]
{recursive ,.{recursive}}           -> (undefined behavior)
++++ {decrement -} ++++ {decrement} -> ++++++++-
{a >>>---<<<} {b {a}{a}} {b}        -> >>>---<<<>>>---<<<

Standard Loopholes apply, and shortest code wins

Could you perhaps add some test cases? Example Brainstract programs and their expected Brainfuck program outputs?

@KevinCruijssen Will do

Could you also link to a Brainstract documentation?

@JonathanFrech Brainstract is actually just a language I made for the purpose of this challenge

@FireCubez Under those circumstances, I would suggest mentioning that the language is newly created and adding a more sophisticated language definition -- what counts as a macro_name, which characters can be used as macros, etc.

Could a macro definition appear anywhere in the Brainstract source code? Or must it appear to the left of its first use? Or must it appear "before" its first use when taking into account how brainfuck moves around its source code?

Is {cat ,.} {cat3 {cat}{cat}{cat}} {cat3} a valid input?

@ngm It can appear anywhere

@Arnauld yes it is, added to question.

(repeating Jonathan Frech) What characters can appear in the macro name? Also, what characters can appear in the input?

@user202729 Any non-whitespace and non-Brainstract/brainfuck characters can appear in the macro name. Input is valid Brainstract characters

@JonathanFrech Done.

Is it guaranteed that the macro name and definition must be  a space, or can it be any whitespace character?

May macro name be empty?

@user202729 Any whitespace character

Let us continue this discussion in chat.

Using -> to separate the input and output in the examples is kinda dumb...

If you have a better idea you can edit the post or tell me

@FireCubez Does the "Any non-whitespace and non-Brainstract/brainfuck characters can appear in the macro name. Input is valid Brainstract characters" still apply? If so, please edit it into the question

@FireCubez it's dumb because both - and > are valid brainfuck characters...

@ASCII-only Well, what I meant by that was "valid Brainstract" i.e. the macro names don't need to be valid brainstract characters

@FireCubez No I mean, most of the answers assume only alphanumeric names, which appears to not fit the spec. Plus, this specific part of the spec isn't in the question yet...

@ASCII-only My original intention for names is the one I specified in the post now, but I wasn't so good at expressing my original intention when I posted this so now all the answers are different from my requirements

Java 8, 251 242 bytes

226 217 bytes of code + 25 bytes for `java.lang.regex.*` import. I can't lambda this since you can't use recursion in a lambda function (self-reference). This just about ignores recursive macros (the space is removed).

9 bytes saved by ceilingcat

import java.util.regex.*;
...
String f(String s){var p=Pattern.compile("\\{(\\w+)\\s+(\\W+)\\}");for(var m=p.matcher(s);m.find();)s=s.replace("{"+m.group(1)+"}",m.group(2)).replace(m.group(0),"");return p.matcher(s).find()?f(s):s.replace(" ","");}

Try it online
Regex source

JavaScript (Node.js), 113 108 102 bytes
-5 bytes because input will always be valid brainstract
-6 bytes thanks to Cows quack for regex function golfs
x=>{while(m=/({\w+)\s+(\W+)}/.exec(x))x=x.replace(eval(`/${m[1]}}/g`),m[2]).replace(m[0],'');return x}

Try it online!
TIO Link includes a test suite of all 4 "valid" test cases provided in the OP.
The invalid recursive macro test was ignored as, given it's undefined behavior and our program can whatever, there's no need to test it; the result is irrelevant.
Ungolfed Explanation:
fun = code => {
    // While there's a macro definition in the code
    while(match = /{(\w+)\s+(\W+)}/.exec(code)) {
        // Replace calls to the macro with the macro's code
        code = code.replace(eval(`/${m[1]}}/g`),m[2])
        // And remove the definition from the code
            .replace(m[0],'');
    }
    // Remove all spaces from the code and return
    return x;
}

The entire function relies on the regex: /{(\w+)\s+(\W+)}/
This should match any valid macro definition and include the macro name in Capture Group 1, and the macro's code in Capture Group 2.
Due to how JS's regex.exec() returns, m[0] is the whole matched string (the entire macro definition), m[1] is the string matched by Capture Group 1 (the macro name) and m[2] is the string matched by Capture Group 2 (the macro's code)
We can then replace all instances of {m[1]} with m[2], then remove the first instance of m[0] in order to remove the macro definition. This is required in part due to the way brainfuck would interpret the macro definition, and in part due to the way the while loop in this function works (it finds the first definition in the code, if we don't remove the definition after we've processed it, it'll keep finding the first definition over and over)
However, our first capture group m[1] also includes the opening brace { of the macro definition. This is so that when replacing {m[1]} with m[2], we actually only need to replace m[1]}, which saves a byte.
Unfortunately including a variable m[1] in a RegExp in JS is a bit costly, as we need to eval the regex, which adds 6 bytes.
There's probably quite a bit of golfing room in this answer, as there tends to me in my NodeJS answers.
If anybody has any suggestions for golfing, let me know in the comments.
However if your answer involves using an entirely different approach to mine, please post your own answer :)

The new appears to be redundant, but eval(\/${m[1]}}/g`)is still shorter. Alsoexecis shorter thanmatch`

@Cowsquack oh nice, thanks!

85

80

but according to the comment, 94

I believe you intended return code; in the ungolfed version

Pip, 33 bytes
Wa~`({\S+)(.+?)}`a:$`.$'R$1.'}$2a

Try it online!
Very similar approach to Xcali's Perl solution, though mostly independently derived.*
Wa~`({\S+)(.+?)}`a:$`.$'R$1.'}$2a
                                   a is 1st cmdline argument (implicit)
Wa~`            `                  While this regex matches in a:
    ({\S+)                         First group: { followed by non-whitespace characters
          (.+?)                    Second group: more characters, as few as possible...
               }                   ... followed by }
                                   This matches a macro definition, including all the
                                   whitespace as part of the replacement code
                                   (It doesn't work for macro definitions with macro calls
                                   inside them, but the leftmost definition at any time
                                   will not have a macro call inside it)
                                   So while possible, match the first occurrence, and:
                 a:                  Set a to:
                   $`                 The portion of the string left of the match
                     .$'              concatenated to the portion right of the match
                        R             In that string, replace
                         $1.'}        match group 1 plus a trailing } (i.e. a macro call)
                              $2      with match group 2 (the macro's code)
                                a  When the loop exits, output the final value of a

* That is, I saw the Perl solution's byte count, went "How?!...", and finally realized I could assume a few things that made the code a lot shorter.

Ruby, 74+1 = 75 bytes
Add one byte for the p flag.
(k=$2;gsub(/#$1( .+?)?\}/){$1?p: k})while~/(\{\w+) (([^{}]|\{\g<2>\})*)\}/

Try it online!

PHP, 197 196 186 bytes
<?php $p=$argv[$c=1];$m=[];while($c)$p=preg_replace_callback("/\{(\w+)(\s((?0)|[^{])+)?\}/",function($a)use(&$m){return count($a)<3?$m[$a[1]]:[$m[$a[1]]=$a[2],""][1];},$p,-1,$c);echo $p;

Try it online!
185 if only one kind of whitespace is accepted (by changing the regex to /\{(\w+)( ((?0)|[^{])+)?\}/) but I'm not sure whether this is valid.
I was tempted to use JavaScript but the RegExp class in JS doesn't support RE recursion...

Python 2, 133 bytes
import re
s=input()
while'{'in s:x=re.findall('{.*? (?:[^{]|{.+})*?}',s)[0];d,c=x.split(' ',1);s=s.replace(x,'').replace(d,c)
print s

Try it online!

118, maybe. idk

@ASCII-only Maybe you want this 127-byte version, but it doesn't work if you stick a letter in the code part of the macro.

"non-brainfuck characters are allowed in output"

@ASCII-only No, I mean that, if you do {someMacro >>>--t-<<<} instead of {someMacro >>>---<<<}, your code doesn't work.

Perl 5 -p, 47 bytes
-11 bytes with ideas from @ASCII-only
$s=$2,s/\Q$1}/$s/g while s/(\{\S+)\s+(\S+?)\}//

Try it online!

40?

Replacing \s+ with   works for all the current testcases as well. hmm

@ASCII-only From a comment: "[The space between the macro name and definition must be]  any whitespace character"

@ASCII-only  I don't think yours works in all cases.  Take a look at the last test case in my new link.

This should work for 41 bytes.

Go, 249 bytes
import."regexp"
func f(C string)string{M,R:=MustCompile,(*Regexp).ReplaceAllString
K:=M(`(.*?){(.*?)\s(.*?)}\s(.*)`).FindAllStringSubmatch(C,-1)
if len(K)<1{return R(M(`\s`),C,"")}
S:=K[0]
U:=R(M(QuoteMeta("{"+S[2]+"}")),S[1]+S[4],S[3])
return f(U)}

Attempt This Online!

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
The least weird fact about the US presidency right now
The least weird fact about the US presidency right now is that there have been two unrelated presidents whose last names start with T-R-U-M.
That made me think, how many US presidents share other combinations of characters? There are obviously two presidents that share the characters "BUSH", and "ROOSEVELT". But did you know there are four presidents who share the characters "BU" (Buchanan, Buren, Bush and Bush), three presidents who share "CL" (Cleveland, Cleveland and Clinton), but only one president whose name starts with an "E" (Eisenhower).

Challenge:
Take a non-empty string as input, and output how many presidents have names starting at those letters. You may assume that the string will match at least one president.
That means, you may get inputs such as "J" (Jackson, Jefferson, Johnson and Johnson), "TA" (Taft and Taylor) and "Nixon" (Nixon). You will not get inputs such as "Z", "RANT" and "RUMP".

Rules

The input is on any convenient format, with optional upper or lower case.
The output should be an integer in the range 1 ... 5.
Shortest code in bytes in each language wins

Test cases
There are three strings that should return 5 (C, H, T), two strings that should return 4 (BU, J), five strings that should return 3 (A, CL, HAR, M, R). There are many strings that should return 2. Where there are parentheses, it means both AD, ADA, ADAM and ADAMS should all return 2, as well as TR, TRU and TRUM. You will not get "TRUT" as input, since that doesn't match a president.
5: C, H, T
4: BU, J,
3: A, CL, HAR, M, R
2: AD (ADAMS), BUS (BUSH), CLE (CLEVELAND), F, G, HARR (HARRISON), JO (JOHNSON), P, RO (ROOSEVELT), TA, TR (TRUM), W
1: Every other valid string

Alphabetical list of surnames
Adams, Adams, Arthur, Buchanan, Buren, Bush, Bush, Carter, Cleveland, Cleveland, Clinton, Coolidge, Eisenhower, Fillmore, Ford, Garfield, Grant, Harding, Harrison, Harrison, Hayes, Hoover, Jackson, Jefferson, Johnson, Johnson, Kennedy, Lincoln, Madison, McKinley, Monroe, Nixon, Obama, Pierce, Polk, Reagan, Roosevelt, Roosevelt, Taft, Taylor, Truman, Trump, Tyler, Washington, Wilson
-------- Same list (obviously) -----------
'Adams', 'Adams', 'Arthur', 'Buchanan', 'Buren', 'Bush', 'Bush', 'Carter', 'Cleveland', 'Cleveland', 'Clinton', 'Coolidge', 'Eisenhower', 'Fillmore', 'Ford', 'Garfield', 'Grant', 'Harding', 'Harrison', 'Harrison', 'Hayes', 'Hoover', 'Jackson', 'Jefferson', 'Johnson', 'Johnson', 'Kennedy', 'Lincoln', 'Madison', 'McKinley', 'Monroe', 'Nixon', 'Obama', 'Pierce', 'Polk', 'Reagan', 'Roosevelt', 'Roosevelt', 'Taft', 'Taylor', 'Truman', 'Trump', 'Tyler', 'Washington', 'Wilson'

Welcome to challenge writing! My OCD is a bit bothered by the fact that Cleveland and Cleveland are the same Cleveland, who was simply elected to two non-consecutive terms, but since there are already answers it's best not to change it now. You may want to post future challenges in the Sandbox first to iron out the wrinkles. Otherwise, this looks like a well-specified challenge.

I feel I should point out that the name is "Van Buren", not "Buren".  Too late to change now, of course.

Python 2, 179 175 173 bytes
lambda s:sum(any(s==X[:len(s)]for X in x.split())for x in[A,B,'A CL HAR M R '+B,'ADAMS BUSH CLEVELAND F G HARRISON JOHNSON P ROOSEVELT TA TRUM W M',s])
A='C H T';B='BU J '+A

Try it online!

tf is this. what is this sorcery

Python 3, 141 140 111 106 97 bytes
Input is in title case, 114 bytes with lowercase input.
-5 bytes thanks to Value Ink.
lambda n:(f"AdamsBushCleveFGHarriJohnsPRooseTaTrumW{0:31}AClHarMR{0:36}BuJCHT".rfind(n[:5]))/39+2

Try it online!

108 bytes that should probably work

JavaScript (ES6), 109 105 102 bytes
Expects the input string in title case.
s=>-~"CHT4BuHaJ3AClHarMR2AdamsBushCleveFGHarriJohnsPRooseTaTrumW1".match(s.slice(0,5)+'.*?(\\d)|1')[1]

Try it online!
How?
We use a lookup string holding prefixes between 1 and 5 characters, along with digits describing the corresponding number of occurrences:
"CHT4BuHaJ3AClHarMR2AdamsBushCleveFGHarriJohnsPRooseTaTrumW1"
 {5-}{4---}{3------}{2-------------------------------------}

We use the following regular expression on this string and apply -~ on the second entry returned by .match():
                                     /PREFIX.*?(\d)|1/
                                      \____/\_/\__/\/
                                        |    |  |  |
the 5 first characters of the input ----+    |  |  |
the shortest possible string (lazy match) ---+  |  |
a digit (captured) -----------------------------+  |
fallback: look for '1' instead (last character) ---+

Examples:

"C" → ['CHT4', '4'] → -~'4' = 5
"Har" → ['HarMR2', '2'] → -~'2' = 3
"Lincoln" → ['1', undefined] → -~undefined = 1

R, 156 bytes
function(k)max(which(mapply(grepl,z<-paste('',k),c(z,' ADAMS BUSH CLEVELAND F G HARRISON JOHNSON P ROOSEVELT TA TRUM W',' A CL HAR M R',' BU J',' C H T'))))

Try it online!
Inspired by @TFeld Python 2 solution

Ruby, 132 100 92 bytes
->s{1+"AdamsBushCleveFGHarriJohnsPRooseTaTrumWAClHarMMRBuBuJJCCHHTT".scan(/#{s[0,5]}/).size}

Try it online!


text:
An ogl-edocf challenge
Input
A non-empty shuffled string consisting of ASCII characters in the range \$[32..126]\$.
Output
The output is obtained by applying successive rotations to the input string.
For each letter ([a-zA-Z]) in the input string, going from left to right:

if the letter is in upper case, rotate all characters before it by one position to the left
if the letter is in lower case, rotate all characters before it by one position to the right

Example
Input: "Cb-Ad"

The first letter is a "C". We should do a rotation to the left, but there's no character before this "C". So, there's nothing to rotate.
The next letter is a "b". We rotate "C" to the right. Because it's a single character, it is left unchanged.
The character "-" does not trigger any rotation, as it's not a letter.
The next letter is a "A". We rotate "Cb-" to the left, which gives "b-CAd"
The fourth and last letter is a "d". We rotate "b-CA" to the right, which gives "Ab-Cd"

Therefore, the expected output is "Ab-Cd".
Rules

You may take input as a string or as an array of characters -- which may or may not be the same thing, depending on your language.
You may also output an array of characters instead of a string.
This is ogl-edocf code-golf

Test cases
"cbad" -> "abcd"
"ACBD" -> "ABCD"
"Cb-Ad" -> "Ab-Cd"
"caeBDF" -> "aBcDeF"
"aEcbDF" -> "abcDEF"
"ogl-edocf" -> "code-golf"
"W o,ollelrHd!" -> "Hello, World!"
"ti HIs SSta ET!" -> "tHis IS a tEST!"

Pyth, 21 20 bytes
VQ=k+.>k-}NG}Nr1GN)k

Try it here
Explanation
VQ=k+.>k-}NG}Nr1GN)k
VQ                )      For each N in the input...
     .>k                 ... rotate k (initially '')...
        -}NG}Nr1G        ... by (N is lowercase) - (N is uppercase)...
    +            N       ... then append N...
  =k                     ... and update k.
                   k     Output the result.

You can use .U to reduce the input from 2nd value. This lets you drop =k from the start, and )k from the end as both the input and printing are implicit. Full program: .U+.>b-}ZG}Zr1GZ - link

Python 2, 100 98 95 bytes
f=lambda s,p='':s and f(s[1:],[p[x:]+p[:x]+s[0]for x in[s[0].isupper()-s[0].islower()]][0])or p

Try it online!

><>, 45 43 bytes
ii:2+7$.::&"`{"@)@(*?}"@["&::&@)@(*?{&!
ror

Try it online!
The fact that ><> has stack rotation helps, but having to check the case of the letter doesn't.
Explanation:
i    Get first inputted character
 i   Get second. This is to prevent errors from rotating an empty stack
  :2+7$.      Jump to the second line if that was EOF
        ::&   Create copies of the input and store one in the register
           "`{"@)@(*     Check if the char is lower case
                    ?}   If so rotate the stack
                      "@["&::&@)@(*?{   Rotate the other way if uppercase
                                     &  Push the new char
                                      ! Skip the first i instruction
Skip to the second line on EOF
ro      Reverse the stack and output
r r     Cancel out the first reverse
 o      Output the rest of the stack

05AB1E, 18 17 16 14 bytes
õsvy.uy.l-._y«

Try it online or verify all test cases.
Explanation:
õ            # Start with an empty string
 sv          # Loop over the characters `y` of the input
   y.u       #  Check if `y` is an uppercase letter (1 if truthy; 0 if falsey)
   y.l       #  Check if `y` is a lowercase letter (1 if truthy; 0 if falsey)
      -      #  Subtract them from each other
       ._    #  Rotate the string that many times (-1, 0, or 1) toward the left
   y«        #  Append the current character `y` to the string
             # (And implicitly output the string after the loop)

Jelly, 14 bytes
ØẠŒHċ€ḅ-N⁸ṙ;ð/

A monadic link accepting a list of characters which yields a list of characters.
Try it online! Or see the test-suite.
How?
ØẠŒHċ€ḅ-N⁸ṙ;ð/ - Link - list of characters
             / - reduce by:
            ð  -   a dyadic chain:  1st call is f(L=1stCharacter, R=2ndCharacter)
               -                    ...then calls are f(L=previousResult, R=nextCharacter)
ØẠ             -     alphabet characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
  ŒH           -     split in half = ["ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz"]
     €         -     for each:
    ċ          -       count occurrences (of R)
               -                          e.g.: 'W' -> [1,0]; 'c' -> [0,1]; '@' -> [0,0]
      ḅ-       -     convert from base -1             -1             1             0
        N      -     negate                            1            -1             0
         ⁸     -     chain's left argument (i.e. L)
          ṙ    -     rotate left by (the negate result)
           ;   -     concatenate R

I don't know Jelly too well, but shouldn't I do the same as ḅ- in this case? It seems to work here, but not in your code. I'm a bit confused why. Also, is there a command to push the entire lists as separated items to the stack in Jelly (wait, Jelly isn't a stack-based language, is it..)? In that case a simple subtract can be used and you also won't need the negate if I'm not mistaken (similar as the last edit in my 05AB1E answer).

I yields a list - add ŒṘ to see a full representation. So ØẠŒHċ€IṪN⁸ṙ;ð/ would work.

Ah ok, that makes sense. Thanks for the explanation. Nice answer btw, already upvoted it yesterday. :)

K4, 43 33 bytes
Solution:
""{.q.rotate[-/y in'.Q`A`a;x],y}/

Examples:
q)k)""{.q.rotate[-/y in'.Q`A`a;x],y}/"Cb-Ad"
"Ab-Cd"
q)k)""{.q.rotate[-/y in'.Q`A`a;x],y}/"ogl-edocf"
"code-golf"
q)k)""{.q.rotate[-/y in'.Q`A`a;x],y}/"ti HIs SSta ET!"
"tHis IS a tEST!"

Explanation:
Iterate over the input string, rotating the previous output by 1, -1 or 0 depending upon it's position in the list "a-zA-Z".
""{.q.rotate[-/y in'.Q`A`a;x],y}/ / the solution
""{                            }/ / iterate (/) over, starting x as ""
                             ,y   / append y to
   .q.rotate[             ;x]     / rotate x by ...
                    .Q`A`a        / the lists "a..z" and "A..Z"
               y in'              / y in each (') alphabet?
             -/                   / subtract (-) over (/)

Notes:

-10 bytes with inspiration from the 05AB1E solution

JavaScript (Node.js), 116 102 bytes
f=(s,i=1)=>s[i]?f(s.replace(RegExp(`^(.)(.{${i}})(?=[A-Z])|^(.{${i}})(.)(?=[a-z])`),"$4$3$2$1"),i+1):s

Try it online!
Original (116 111 106B)
s=>Buffer(s).map((x,i)=>s=(t=s[S="slice"](i),i<2)?s:x>64&x<91?s[S](1,i)+s[0]+t:x>96&x<123?s[i-1]+s[S](0,i-1)+t:s)&&s
s=>Buffer(s).map((x,i)=>i<2|--x%32>25|x<64?s:s=[s[S="slice"](1,i)+s[0],s[i-1]+s[S](0,i-1)][+(x>95)]+s[S](i))&&s
s=>Buffer(s).map((x,i)=>!i|--x%32>25|x<64?s:s=(w=x>95,t=s.slice(1-w,i-w),w?s[i-1]+t:t+s[0])+s.slice(i))&&s

It’s probably shorter to do eval(\regex`)` than using the constructor

@Downgoat I'm afraid that's not the case because the slashes are needed in the case of eval(`regex`), so -2+2=0 and thus it doesn't help reducing byte counts.

@Downgoat It is worth using eval() when at least one flag is used: eval('/./g') is 3 bytes shorter than RegExp('.','g').

@Arnauld That's true, but I don't use flags here.

@ShieruAsakoto (Sure. My comment was primarily addressed to Downgoat to explain why it's not worth doing it here.)

@Arnauld Oh I see. BTW I'm finding a way to go down to 100 but to no avail still.

Haskell, 122 92 bytes
Thanks to BWO for the suggestions! I also saved a lot by taking a slightly different approach than my original answer.
l@(a:b)!c|'`'<c,c<'{'=last l:init l++[c]|'@'<c,c<'['=b++[a,c]|0<1=l++[c]
f(c:s)=foldl(!)[c]s

Try it online!

You can swap the pattern-match of (#), use , over &&, use [l!!0,c] over head l:[c], 1>0 instead of True, you don't need to count f= and you can assume non-empty input which saves the l==[] guard - saving you 13 bytes: Try it online!

Btw. I used the isLower and isUpper golf in my submission, I hope you're okay with that otherwise I'll reverse my edit.

@BWO Thanks for the suggestions, and go right ahead!

Haskell, 101 91 bytes
-10 bytes inspired by Curtis Bechtel's answer (use '@'<c,c<'[' over elem c['A'..'Z'] and the according range for lower-cased letters).
g(x:y)=foldl((<>pure).(!))[x]y
x@(a:b)!c|'`'<c,c<'{'=last x:init x|'@'<c,c<'['=b++[a]|0<1=x

Try it online!
Explanation / Ungolfed
The operator (!) takes a non-empty string x on which we can pattern-match and a character:
x@(a:b) ! c
  | '`' < c, c < '{' = last x : init x  -- rotate x to the right by one
  | '@' < c, c < '[' = b ++ [a]         -- rotate x to the left by one
  | otherwise = x                       -- keep x as is

Now we can reduce the input's tail from the left to the right, starting with the first character of the input using:
\b a -> b!a ++ [a]

Ruby, 51 bytes
->s{w=[];s.map{|x|w.rotate!(x=~/\W/||?_<=>x)<<x};w}

Try it online!
Input and output are arrays of characters
The trick:
The code is pretty straightforward, except perhaps the rotation part:
(x=~/\W/||?_<=>x)

x is a single character, which could be a letter, the first expression x=~/\W/ returns nil if it's a letter, and 0 otherwise. If it's 0, we're done, if not, the logical or checks the second expression: ?_<=>x returns -1 for upper case and 1 for lower case. So the rotation is:

-1 (1 to the left) for upper case
+1 (1 to the right) for lower case
0 (no rotation) if it's not a letter

Red, 110 bytes
func[s][p: s forall s[if all[(a: first s)>#"@"a < #"["][move p back s]if all[a >#"`"a <#"{"][move back s p]]p]

Try it online!
Explanation:
f: func [ s ] [
    p: s                                ; store the starting position of the string in p
    forall s [                          ; iterate through the entire string
        a: first s                      ; store the current character in a
        if all [ a > #"@" a < #"[" ] [  ; if `a` is a uppercase letter
            move p back s               ; move the starting char to the position before current
        ]
        if all [ a > #"`" a < #"{" ] [  ; if `a` is a lowercase letter
            move back s p               ; move the character before the current one to the start
        ]
    ]
    p                                   ; return the string
]

Japt, 17 16 14 bytes
Takes input as an array of characters, outputs a string
;rÏiXéCøY -BøY

Try it

Explanation
 rÏ                :Reduce by passing the current result (X) & the current element (Y) through a function
   i               :  Prepend to Y
    Xé             :  X rotated right by
;     B            :    Uppercase alphabet
       øY          :    Contains Y?
          -        :    Subtract
;          C       :    Lowercase alphabet
            øY     :    Contains Y?

Perl 6, 47 bytes
*.reduce:{|@$^a.rotate($^b~~/\w/&&'_'leg$b),$b}

Try it online!
Works on an array of chars.

Ah, I would have gone for using cmp and uc/lc, but that comes to 49 bytes

Darn, 48 bytes Almost caught up

Jelly, 19 bytes
W€ḷṙ01ŒlƑ?-ŒuƑ?};ʋ/

Try it online!

R, 107 102 100 bytes
Massive because R's string manip is bulky. Can anyone get it under 100?
-5 bytes using the "set loop variables to F to avoid initializing" trick.
-2 bytes by assuming all characters are printable and using 2*!k%%97>25 rather than 2*k%in%97:122 for testing lower case, using operator precedence.
function(x){for(k in u<-utf8ToInt(x))u[1:F-1]=u[(1:(F=F+1)+k%in%65:90-2*!k%%97>25)%%F];intToUtf8(u)}

Try it online!

Come join us (it's just me right now...) in the R golf chatroom to bounce some ideas around! My guess is that the permutation piece is as short as it can be with this approach but not having tried it myself, I can't say for sure.

Java 10, 149 119 bytes
s->{for(int i=1;i<s.length();)s=s.replaceAll("^(.)(.{"+i+"})(?=[A-Z])|^(.{"+i+++"})(.)(?=[a-z])","$4$3$2$1");return s;}

Port of @ShieruAsakoto JavaScript answer, so make sure to upvote him.
Try it online.
Explanation:
s->{                          // Method with String as both parameter and return-type
  for(int i=1;i<s.length();)  //  Loop `i` in the range [1, length)
    s=s.replaceAll("^(.)(.{"+i+"})(?=[A-Z])|^(.{"+i+++"})(.)(?=[a-z])","$4$3$2$1");
                              //   Rotate the substring of [0, i] either left or right
  return s;}                  //  Return the modified input-String as result

Japt, 25 23 bytes
I give up, Can't make it shorter
-2 bytes from @ETHproductions
£=¯Y éXè\a -Xè\A)+UsYÃU

£=¯Y éXè\a -Xè\A)+UsYÃU     Full program. Implicit input U
£                           map each char
 =                          set U equal to:
  ¯Y                        U sliced to current mapped value
    éXè\a -Xè\A)            and rotated left or right 1 char
                +UsY        append the non-sliced U value
                      ÃU    Output U

Try it online!

Sadly, I can't find a shorter way to do éXè\a -Xè\A either :-( You could save two bytes by changing the double space to a ), and removing © (implicit comma means that U is still outputted)

Save another 2 bytes by dropping ÃU and using the -h flag.

Stax, 32 bytes
éG7[Æ┐äZ▬Θε♫∙~╞ÉH╔u╬←J╛ü╢(┼▒uX)Ü

Run and debug it
B]s{c97 123:bsaa|)sc65 91:bsaa|(s+c}fd  #Full program, unpacked, implicit input
B]s                                     #Unons-left, singleton, swap top 2 of stack
   {c                                   #Copy iterative letter
     97 123                             #Put 97 and 123 on stack(lower case)
           :bsaa                        #Check if iterative letter is between range, swap orientation back to proper order
                |)                      #Rotate if the letter is within range
                  sc                    #Swap top 2 and copy top
                    65 91               #Put 65 and 91 on stack (Capitals)
                         :bsaa          #Check if iterative letter is between range, swap orientation back to proper order
                              |(        #Rotate if the letter is within range
                                s+c     #swap, concat and copy
                                   }fd  #remove duplicate of original answer after loop and implicitly print

A lot of stack swapping which is probably unnecessary. I really would like to get this down more, but I was strugging with the ordering of the stack. Maybe somebody can figure it out if they are bored. Will keep working on it.

Attache, 69 bytes
~Fold[{s'r.=_'sp;Rotate[s,&`-!Has&r[0]=>ALPHA'alpha]+r}@SplitAt]#Iota

Try it online!
Explanation
General shape
The function looks generally like this:
~Fold[{...}]#Iota

Which folds {...} over each member in the range from 0 to #input - 1 (Iota), starting with the input as a seed.
The inner function
The following function is called as f[building, index] and is called with each index from 0 to #input exclusive. @SplitAt calls SplitAt on these arguments, splitting the input string on index.
{s'r.=_'sp;Rotate[s,&`-!Has&r[0]=>ALPHA'alpha]+r}
{                                               }    anonymous function taking the split string
                                                     e.g.: ["cd-", "Adf!"]
      _'sp                                           concat the input with a space
                                                     e.g.: ["cd-", "Adf!", " "]
                                                     (this is to handle index = 0)
 s'r.=                                               `s` is the first member, and `r` is the second
           Rotate[s,                         ]       rotate `s` by:
                                  ALPHA'alpha          over uppercase and lowercase alphabets:
                        Has&r[0]=>                       test if r[0] is in each alphabet
                                                       e.g.: [true, false]
                    &`-!                               subtract the second from the first
                                                       e.g.: (true - false) = 1 - 0 = 1
                                                     s is rotated according to the following map:
                                                       uppercase =>  1
                                                       symbol    =>  0
                                                       lowercase => -1
                                              +r     append the right portion of the string

Essentially, this function rotates the left portion of the string according to the first character of the right portion.

Charcoal, 20 bytes
ＦＳ≔⁺⭆ω§ω⁻⁺λ№αι№βιιωω

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

Loop over the input characters.
≔⁺⭆ω§ω⁻⁺λ№αι№βιιω

Map over the string of collected characters so far, cyclically indexing into the collected characters so far with the index incremented or decremented if the current character is upper or lower case respectively. This completes the rotation. The next character is then concatenated, and the result assigned back to the string.
ω

Print the result.

MATL, 20 bytes
ttYo-ZS"X@q:&)w@YSwh

Try it online!
-4 bytes thanks to Luis Mendo.
Converts uppercase/lowercase/non-letter to [-1,0,1] (first half of the program). Applies circshift consecutively (second half). I'm wrecking my brain if there's a better way to map uppercase/lowercase to [-1,0,1] (see the second version), and perhaps a way to reverse the string right away so as to get rid of the two w's needed for the &).

Retina, 67 64 58 bytes
^
¶
+`(.*)(.)¶([a-z])|(.)(.*)¶([A-Z])|¶(.)
$2$1$3$5$4$6$7¶

-9 bytes thanks to @Neil removing the three unnecessary ? I had added, as well as the unnecessary (.*) in the else-case.
Try it online or verify all test cases. (NOTE: Outputs with a trailing newline. The header in the test suite is to test each input-line as a separate test case, and the footer is to remove that trailing newline for a more compact output.)
Explanation:
Prepend a newline before the input:
^
¶

Continue replacing as long as we can find a match:
+`

Everything else is three different checks merged together:
If the character right after the newline is lowercase letter: rotate everything before the newline once towards the right, and then append that character and the newline:
(.*)(.)¶([a-z])
$2$1$3¶

If the character right after the newline is an uppercase letter: rotate everything before the newline once towards the left, and then append that character and the newline:
(.)(.*)¶([A-Z])
$2$1$3¶

Else (neither a lowercase nor uppercase letter): simply shift the newline once towards the right for the next 'iteration':
¶(.)
$1¶

These three checks above are merged with regex OR statements (|) and larger group-replacements to make it act like an if(lowercase) ... elseif(uppercase) ... else ...:

I don't think you need the ?s - if there's nothing to rotate yet, it doesn't matter whether there's a letter.

Also, replacing (.*)¶(.) with $1$2¶ can be simplified to replacing ¶(.) with $1¶ as the other capture doesn't affect the result.

@Neil Ah, of course thanks. -9 bytes right there! :)

C (clang), 168 159 153 119 bytes
g,i,j;f(char*a){for(i=0;a[j=i++];islower(a[i])?g=a[j],bcopy(a,a+1,j),*a=g:isupper(a[i])?g=*a,bcopy(a+1,a,j),a[j]=g:0);}

-26 thanks to @ceilingcat
Try it online!

Suggest g=a[j=i++];islower(a[i])?bcopy(a,a+1,j) instead of a[j=i++];islower(a[i])?g=a[j],bcopy(a,a+1,j)

Pyth, 16 bytes
em=+.>k-F}RGrBd2

Try it here!
Explanation:
em=+.>k-F}RGrBd2dQ    Autofill variables
 m               Q    for each d in Q (the input):
            rBd2       Take [d, swapcase(d)]
         }RG           Figure out which are in the lowercase alphabet (returns [1,0] for lowercase, [0,1] for uppercase, [0,0] for non-letters)
       -F              Fold on subtraction (1 for lowercase, -1 for uppercase, 0 for non-letter)
    .>k                Cycle the processed part (k) of the input right by ^ steps
   +            d      Add in the new character at the end
  =   k                Store new process step back into k (k starts as an empty string)
e                     Get the (e)nd step's output.


text:
Output a Sudoku board
Today's challenge is simple: Without taking any input, output any valid sudoku board.
In case you are unfamiliar with sudoku, Wikipedia describes what a valid board should look like:

The objective is to fill a 9×9 grid with digits so that each column, each row, and each of the nine 3×3 subgrids that compose the grid (also called "boxes", "blocks", or "regions") contains all of the digits from 1 to 9.

Now here's the thing... There are 6,670,903,752,021,072,936,960 different valid sudoku boards. Some of them may be very difficult to compress and output in fewer bytes. Others of them may be easier. Part of this challenge is to figure out which boards will be most compressible and could be outputted in the fewest bytes.
Your submission does not necessarily have to output the same board every time. But if multiple outputs are possible, you'll have to prove that every possible output is a valid board.
You can use this script (thanks to Magic Octopus Urn) or any of these answers to verify if a particular grid is a valid solution. It will output a [1] for a valid board, and anything else for an invalid board.
I'm not too picky about what format you output your answer in, as long as it's clearly 2-dimensional. For example, you could output a 9x9 matrix, nine 3x3 matrices, a string, an array of strings, an array of 9-digit integers, or nine 9-digit numbers with a separator. Outputting 81 digits in 1 dimension would not be permitted. If you would like to know about a particular output format, feel free to ask me in the comments.
As usual, this is code-golf, so write the shortest answer you can come up with in the language(s) of your choosing!

Can we output three 3x9 matrices? Each row of each submatrix representing a row in the sudoku board. Like this

Related but not a dup. Also, if you're allowing flexible output I'm not sure that [tag:kolmogorov-complexity] applies, since that is normally for fixed outputs like exact ascii art.

Pyth, 22 14 12 10 bytes
.<LS9%D3 9

Saved 2 bytes thanks to Mr. Xcoder.
Try it here
.<LS9%D3 9
     %D3 9     Order the range [0, ..., 8] mod 3.
  >            For each, ...
.< S9          ... Rotate the list [1, ..., 9] that many times.

11: m.<S9d%D3 9.

Cross that out, 10: .<LS9%D3 9.

Might wanna update the link (tio)

Python 2, 47 bytes
l=range(1,10)
for x in l:print(l*9)[x*8/3:][:9]

Try it online!

T-SQL, 96 89 bytes
Found one shorter than the trivial output!
SELECT SUBSTRING('12345678912345678',0+value,9)FROM STRING_SPLIT('1,4,7,2,5,8,3,6,9',',')

Extracts 9-character strings starting at different points, as defined by the in-memory table created by STRING_SPLIT (which is supported on SQL 2016 and later). The 0+value was the shortest way I could do an implicit cast to integer.
Original trivial output (96 bytes):
PRINT'726493815
315728946
489651237
852147693
673985124
941362758
194836572
567214389
238579461'

Jelly, 7 bytes
9Rṙ%3$Þ

Try it online!
And a little bit of this...
-1 thanks to Jonathan Allan('s thinking?)

Python 2, 53 bytes
r=range(9)
for i in r:print[1+(j*10/3+i)%9for j in r]

Try it online!

Alternatives:
Python 2, 53 bytes
i=0;exec"print[1+(i/3+j)%9for j in range(9)];i-=8;"*9

Try it online!
Python 2, 54 bytes
for i in range(81):print(i/9*10/3+i)%9+1,'\n'*(i%9>7),

i=0;exec"print[1+(i/3+j)%9for j in range(9)];i+=10;"*9

r=range(9);print[[1+(i*10/3+j)%9for j in r]for i in r]

Python 3, 58 55 bytes
l=*range(10),
for i in b"	":print(l[i:]+l[1:i])

Try it online!

-3 bytes thanks to Jo King,

The elements of the byte string end up giving the numbers [1, 4, 7, 2, 5, 8, 3, 6, 9] which are used to permute the rotations of [0..9]. The 0 is removed in l[1:i] and there is no need for a null byte which takes two characaters (\0) to represent in a bytes object.
55 bytes
_,*l=range(10)
for i in b"	":print(l[i:]+l[:i])

55 bytes

@JoKing Clever, thanks

JavaScript (Node.js), 47 bytes
Output as an array of the rows.
_=>[...w="147258369"].map(x=>(w+w).substr(x,9))

Try it online!
Generates this:
472583691
583691472
691472583
725836914
836914725
914725836
258369147
369147258
147258369

Octave & Matlab,50 48 29 bytes
mod((1:9)+['furRaghAt']',9)+1

Try it online!
-2 thanks to Johnathon frech
-14 thanks to Sanchises Broadcast addition suggestion, who also pointed out the non-compatibility.
-5 by noticing that the vector can be written in matlab with a char string and transposition.
Was intuitive, now not so.
Uses broadcast summing to spread 1:9 over 9 rows, spread by values determined by the char string.
Sudoku board produced:
 5 6 7 8 9 1 2 3 4
 2 3 4 5 6 7 8 9 1
 8 9 1 2 3 4 5 6 7
 3 4 5 6 7 8 9 1 2
 9 1 2 3 4 5 6 7 8
 6 7 8 9 1 2 3 4 5
 7 8 9 1 2 3 4 5 6
 4 5 6 7 8 9 1 2 3
 1 2 3 4 5 6 7 8 9

Hello and welcome to PPCG; nice first post.

48 bytes.

Of course, s could be defined in the matrix itself. I must have miscounted the bytes as well.

This is now Octave, no longer compatible with MATLAB. If you like, you can use the little chain icon at the top of Jonathan's link to copy paste the default PPCG formatting.

If you like, you can get this down to 34 bytes with broadcast addition: Try it online!

Thanks for pointing out the issue Sanchises, now fixed with your suggestion and improved on top.

Save one more: (1:9)+'furRaghAt'.'.

Jelly, 9 8 bytes
9Rṙ`s3ZẎ

Try it online!
9Rṙ`s3ZẎ
9R         Range(9) -> [1,2,3,4,5,6,7,8,9]
   `       Use the same argument twice for the dyad:
  ṙ        Rotate [1..9] each of [1..9] times.
           This gives all cyclic rotations of the list [1..9]
    s3     Split into three lists.
      Z    Zip. This puts the first row of each list of three in it's own list,
           as well as the the second and third.
       Ẏ   Dump into a single list of nine arrays.

Batch, 84 bytes
@set s=123456789
@for %%a in (0 3 6 1 4 7 2 5 8)do @call echo %%s:~%%a%%%%s:~,%%a%%

Uses @Mnemonic's output. call is used to interpolate the variable into the slicing operation (normally it only accepts numeric constants).

Perl 6, 40 32 27 bytes
-5 bytes thanks to nwellnhof
{[^9+1].rotate($+=3.3)xx 9}

Try it online!
Anonymous code block that returns a 9x9 matrix. Maps each row to a different rotation of the range 1 to 9.

05AB1E, 14 12 bytes
8ÝΣ3%}ε9Ls._

-2 bytes by creating a port of @Mnemonic's Pyth answer.
Try it online. (Footer is added to pretty-print it. Actual result is a 9x9 matrix; feel free to remove the footer to see.)
Explanation:
8Ý              # List in the range [0, 8]
  Σ  }          # Sort the integers `i` by
   3%           #  `i` modulo-3
      ε         # Map each value to:
       9L       #  List in the range [1, 9]
         s._    #  Rotated towards the left the value amount of times

Original 14 bytes solution:
9Lε9LN3*N3÷+._

Try it online. (Footer is added to pretty-print it. Actual result is a 9x9 matrix; feel free to remove the footer to see.)
Explanation:
9L                # Create a list of size 9
  ε               # Change each value to:
   9L             #  Create a list in the range [1, 9]
     N3*N3÷+      #  Calculate N*3 + N//3 (where N is the 0-indexed index,
                  #                        and // is integer-division)
            ._    #  Rotate that many times towards the left

Both answers result in the Sudoku:
123456789
456789123
789123456
234567891
567891234
891234567
345678912
678912345
912345678

Java 10, 82 75 bytes
v->{for(int i=81;i-->0;)System.out.print((i/9*10/3+i)%9+1+(i%9<1?" ":""));}

-7 bytes by creating a port of one of @TFeld's Python 2 answers.
Try it online.
Explanation:
v->{                    // Method with empty unused parameter and no return-type
  for(int i=81;i-->0;)  //  Loop `i` in the range (81, 0]
    System.out.print(   //   Print:
     (i/9               //    (`i` integer-divided by 9,
         *10            //     then multiplied by 10,
         /3             //     then integer-divided by 3,
           +i)          //     and then we add `i`)
             %9         //    Then take modulo-9 on the sum of that above
               +1       //    And finally add 1
    +(i%9<1?            //    Then if `i` modulo-9 is 0:
            " "         //     Append a space delimiter
           :            //    Else:
            ""));}      //     Append nothing more

Outputs the following sudoku (space delimited instead of newlines like below):
876543219
543219876
219876543
765432198
432198765
198765432
654321987
321987654
987654321

J, 18 bytes
>:(,&|:|."{,)i.3 3

Try it online!
Output
1 2 3 4 5 6 7 8 9
4 5 6 7 8 9 1 2 3
7 8 9 1 2 3 4 5 6
2 3 4 5 6 7 8 9 1
5 6 7 8 9 1 2 3 4
8 9 1 2 3 4 5 6 7
3 4 5 6 7 8 9 1 2
6 7 8 9 1 2 3 4 5
9 1 2 3 4 5 6 7 8

How it works
>:(,&|:|."{,)i.3 3
             i.3 3  The 2D array X = [0 1 2;3 4 5;6 7 8]
   ,&|:|."{,        3-verb train:
   ,&|:               Transpose and flatten X to get Y = [0 3 6 1 4 7 2 5 8]
           ,          Flatten X to get Z = [0 1 2 3 4 5 6 7 8]
       |."{           Get 2D array whose rows are Z rotated Y times
>:                  Increment

Fancy version, 23 bytes
|.&(>:i.3 3)&.>|:{;~i.3

Try it online!
Output:
┌─────┬─────┬─────┐
│1 2 3│4 5 6│7 8 9│
│4 5 6│7 8 9│1 2 3│
│7 8 9│1 2 3│4 5 6│
├─────┼─────┼─────┤
│2 3 1│5 6 4│8 9 7│
│5 6 4│8 9 7│2 3 1│
│8 9 7│2 3 1│5 6 4│
├─────┼─────┼─────┤
│3 1 2│6 4 5│9 7 8│
│6 4 5│9 7 8│3 1 2│
│9 7 8│3 1 2│6 4 5│
└─────┴─────┴─────┘

How it works
|.&(>:i.3 3)&.>|:{;~i.3
                    i.3  Array [0 1 2]
                 {;~     Get 2D array of boxed pairs (0 0) to (2 2)
               |:        Transpose
|.&(>:i.3 3)&.>          Change each pair to a Sudoku box:
            &.>            Unbox
    >:i.3 3                2D array X = [1 2 3;4 5 6;7 8 9]
|.&                        Rotate this 2D array over both axes
                             e.g. 1 2|.X gives [6 4 5;9 7 8;3 1 2]
            &.>            Box again so the result looks like the above

Haskell, 41 bytes
[[x..9]++[1..x-1]|x<-[1,4,7,2,5,8,3,6,9]]

Try it online!

This is not valid. Each square contains multiple of the same number. You could do something like this (43 bytes) instead

Thanks! I took your suggestion

@RushabhMehta I did. It was 43 bytes but I removed the s= since it isn't necessary

Ruby, 34 bytes
(a=*1..9).map{|x|p a.rotate x*3.3}

Try it online!

MathGolf, 16 11 bytes
9{9╒♂ï*3/Ä╫

Try it online!
Saved 5 bytes thanks to JoKing

11 bytes

Python - 81 bytes
l=list(range(1,10))
for i in range(1,10):print(l);l=l[3+(i%3==0):]+l[:3+(i%3==0)]

Try it Online
I like having 81 bytes, but after some optimizing :(
Python 2 - 75 68 59 58 bytes
-7 bytes thanks to @DLosc
-9 bytes thanks to @Mnemonic
-1 byte thanks to @JoKing
l=range(1,10)
for i in l:print l;j=i%3<1;l=l[3+j:]+l[:3+j]

Try it Online

81 bytes Perfect score! :D

@DJMcMayhem I was considering making it shorter by doing r=range(1,10) but I couldn't ruin the beauty

68 bytes ;)

@DLosc Ooh clever reuse of l

If you don't mind Python 2, you can take the parens out of the print and remove the list packing.

How exactly do you remove the list packing?

range already returns a list in Python 2.  59 bytes

@Mnemonic Oh right, I forgot, xrange is the generator in Python 2

Huge Thanks to @Shaggy!
JavaScript (Node.js), 61 bytes
t=>[...s='123456789'].map(e=>s.slice(t=e*3.3%9)+s.slice(0,t))

Try it online!

A quick bit of golfing gets this down to 63 bytes.

Sorry, 61 bytes; missed a stupidly obvious golf!

R, 54 bytes
x=1:9;for(y in(x*3)%%10)print(c(x[-(1:y)],x[(1:y)]))

Output:
[1] 4 5 6 7 8 9 1 2 3
[1] 7 8 9 1 2 3 4 5 6
[1] 1 2 3 4 5 6 7 8 9
[1] 3 4 5 6 7 8 9 1 2
[1] 6 7 8 9 1 2 3 4 5
[1] 9 1 2 3 4 5 6 7 8
[1] 2 3 4 5 6 7 8 9 1
[1] 5 6 7 8 9 1 2 3 4
[1] 8 9 1 2 3 4 5 6 7

Try it online!

Python 2, 48 bytes
r='147258369'
for i in r:print(r*4)[int(i):][:9]

Try it online!

Python 3, 51 bytes
r='147258369';print([(r*4)[int(i):][:9]for i in r])

C (clang), 65 bytes
f(i){for(i=0;i<81;)printf("%d%c",(i/9*10/3+i)%9+1,i++%9>7?10:9);}

The function is now able to be reused
Try it online!

Instead of printing a NUL byte to seperate your digits, you could use a tab character at the same byte count.

"Your submission does not necessarily have to output the same board every time. But if multiple outputs are possible, you'll have to prove that every possible output is a valid board." It does not say that multiple outputs are needed. @ceilingcat

@Logern The rule in question is that function submissions have to be reusable. It’s fine if it f(); f() outputs the same board twice, but not if the second call doesn’t work at all.

63 bytes

61 bytes, incorporating suggestions from @JoKing f(i){for(i=81;i--;)printf("%d%c",(i/9*10/3+i)%9+1,i%9?9:10);}

Canvas, 13 11 bytes
◂ｊ３［«３［Ｔ３［«

Try it here!

Charcoal, 14 bytes
Ｅ⁹⭆⁹⊕﹪⁺÷×χι³λ⁹

Try it online! Link is to verbose version of code. Uses @Mnemonic's output. Explanation:
Ｅ⁹              Map over 9 rows
  ⭆⁹            Map over 9 columns and join
          ι     Current row
         χ      Predefined variable 10
        ×       Multiply
       ÷   ³    Integer divide by 3
            λ   Current column
      ⁺         Add
     ﹪       ⁹  Modulo 9
    ⊕           Increment
                Implicitly print each row on its own line

Japt, 11 10 bytes
9õ ñu3
£éX

Try it or verify the output

Explanation
9õ         :Range [1,9]
   ñ       :Sort by
    u3     :  Mod 3 of each
\n         :Assign to variable U
£          :Map each X
 éX        :  U rotated right by X

K (ngn/k), 16 bytes
1+9!(<9#!3)+\:!9

Try it online!
First answer in ngn/k, done with a big help from the man himself, @ngn.
How:
1+9!(<9#!3)+\:!9 // Anonymous fn
              !9 // Range [0..8]
    (     )+\:   // Sum (+) that range with each left (\:) argument
        !3       // Range [0..2]
      9#         // Reshaped (#) to 9 elements: (0 1 2 0 1 2 0 1 2)
     <           // Grade up
  9!             // Modulo 9
1+               // plus 1

Husk, 8 bytes
ṠmṙÖ%3ḣ9

Try it online!

Deadfish~, 344 bytes
{iiiii}icicicicicicic{d}iicic{dddd}c{iiii}iiiicicicic{d}iicicicicic{dddd}dddc{iiiii}dddc{d}iicicicicicicicic{dddd}ddddddc{iiii}cicicicicicicic{d}iic{dddd}ic{iiii}iiicicicicic{d}iicicicic{dddd}ddc{iiii}iiiiiicic{d}iicicicicicicic{dddd}dddddc{iiii}dcicicicicicicicic{ddddd}iiic{iiii}iicicicicicic{d}iicicic{dddd}dc{iiii}iiiiicicic{d}iicicicicicic

Try it online!