text:
MacGyver's Toolbox
In this question each answer will get a "toolbox" that can be used to construct a program/function.  The toolbox will consist of two things:

a list of programming languages
a list of valid characters

You must write a valid program/function in one of the languages provided using only the characters in the toolbox.  Your program/function should output the number of answers already present on this question.
Once you have written and posted an answer the language and characters you have used will be removed from the toolbox and 1 new language and 12 new characters will be randomly added to be used as the toolbox for the next answer.
Rules

Each answer will:

Output the number of valid answers coming before it
Contain a subset of the characters provided in the toolbox for that answer.  (repeats are allowed)
Be in one of the languages from the provided toolbox

The next toolbox will determined by this python program.  To generate the next toolbox put in the remaining languages and characters along with the post id of the last answer.
The language list here is all the languages available on try it online at the time of this post.  The characters have char codes 0-127.
You may write either a full program or a function as your answer.  Since REPLs are different languages they will not be allowed.  (use the TIO version of every language)
If a language uses a special encoding the characters should be interpreted as bytes (decoded from ASCII and padded with a zero).
The starting toolbox will be randomized from this questions post id (126063), there will be 7 languages to start and I will add the characters echoprint0 and ascii 0-31 for free to get people started.
You may not answer twice in a row

Scoring
Each person will have a score equal to the number valid answers they have provided.  There will not necessarily be an end and I will not be accepting any answers.
Sporting
This is a competition, but I encourage you to put fun above winning while still staying competitive (if I could make the winning criteria "fun had" I would).  Some things that are not fun:

Intentionally using characters you don't need to stunt future answers.
Attempting to game the post id system to make future tool boxes harder to use.
Attempting to game the post id system to make future tool boxes easier to use.

I can't prevent any one from doing these things, but I will be downvoting any answers I suspect are doing this.
On a more positive note, here are some things that are good sporting and encouraged:

Coordinating with other users in chat.
Saving characters for harder or more restrictive languages

Can we output numbers in bases other in 10?

@ComradeSparklePony If that is the standard way of outputting in a language.

Well...an interesting setup that got nipped in the bud early due to too many missing characters for languages that are defined by a very small set of characters. Logicode got hosed by the lack of a 1 and ! in its toolbox. I managed to produce the string "0110" using ?,0 and + although I couldn't quite figure out what the ? actually did (and it was not in the language specification).  But + was missing from the toolbox as well, along with = which would have allowed for variable assignment.  Aaanndd...no o for output.

@Draco18s I found an SML answer, so maybe now there are enough chars available for a logicode answer.

@Laikoni Nice! I couldn't find specs for several of the languages, SML being one of them.

...Are Emojicode programs even possible in this challenge? It's one of the available languages, but I can't figure out how one would produce a

@Draco18s I'll look into it, they may be possible if not I'll remove them from the rotation.

There may also be another bug: https://codegolf.stackexchange.com/questions/126063/macgyvers-toolbox/126432?noredirect=1#comment311251_126432 13 Ws in the toolbox linked on that answer.

What about emojis for use in Emojicode?

@SantiagoBenoit I have removed emojicode

Adding 12 new characters each time may have made this too easy.

@mbomb007 You are almost certainly correct.  I wasn't able to get enough people to help me test this before release.  I hope to re-release this challenge with a number of improvements, among them a lower character influx.

Or, maybe make it so that the characters added don't have to be unique, so it might not actually add as many until more are missing.

@WheatWizard There are repeat languages showing up as options now. We have already done Go and Forte. Should we just remove them and continue? In your future version, I think that the input should have the languages that have already been done, rather than what it is.

@andrewarchi Repeat languages are intentional, I don't know if I would disallow them in future versions they keep things interesting.

2. Cubix, (no@
Third time's the charm
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((no@((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((

Try it online!
Next toolbox

1. 3var (1 byte)
Toolbox
['elf', 'cubix', 'sml-mlton', 'forte', 'logicode', 'python1', '3var']
'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e.0@BGN`ceghilnoprtvwz}'

Code
p

Try it online!
Next toolbox

3. Pari/GP, 3 bytes
`
2

Exploits a syntax error.
Try it online!
Next toolbox

5. J, 3 Bytes
5|9

Performs 5 mod 9, outputting 4
Next toolbox!

I pasted in the wrong toolbox link, it should be correct now

you still need the answer to output 4

In the question: Each answer will: Output the number of valid answers coming before it. There are four valid answers before this one, so your program must output 4. If you cannot make that happen, please delete your answer.

Apologies, I misread the requirements. I've fixed it.

Can you post a TIO link?  Also I'm pretty sure that's 9 mod 5, not 5 mod 9

That's 9 mod 5.

15. Half-Broken Car in Heavy Traffic
#
^
^
^
^
^
^
^
^
^
^
^
^   >>v
  < ^
^ >   v
  ov ^
^< <  <

Outputs is in cell -2.
Try it online!
Next Toolbox

For number 16, I don't think it is possible in TRANSCRIPT or Emojicode. Transcript requires a > before lines that do stuff like print, and Emojicode needs emojis.

For 16 in scala, how much of this is needed? object A{def main(a:Array[String]){print(Integer.parseInt("F",16))}} TIO. Most of that is the main, so can that be left out?

@andrewarchi You can write an function that returns 16.  That might save you.  I don't know scala so thats about as helpful as I can be.  However we currently have all of the characters so I wouldn't worry about using them.

@WheatWizard The two changes that I see are hbcht which I used and emojicode which seems to be removed from the generator program entirely. I assume the emojicode change was intentional. I didn't do that.

@Riley Ah I see all is good then.

6. Forte
Uses \n 187-DENPUT
1 PUT 71-18
7 END

Try it online!
Next toolbox

no ( -> scheme-chez , scala. no 1 nor ! -> logicode

@marcosm Good point, I hope my toolbox didn't stop the chain ;_;

logicode actually has a problem with the fact that the characters to write out are missing. I managed to get out ?+?+?+0 to produce the binary expression of 6....which appears to be valid if "that is the standard way of outputting in a language" is allowed here, which for logicode would be mostly true. There is a convert-to-ascii, but without an = you can't assign ?+?+?+0-like expressions to a variable to convert, nor can you wrap in parenthesis, due to a lack of (. ?+?+?+0 by itself is valid code...but produces no output. + is also missing, so even that won't work...

no E -> Forte (program would loop forever without an END keyword) as no P,R,N, and T for the PRINT command.
I cannot find a language definition for elf, assembly-as, or mlton (or at least, not enough in order to determine how to produce output).
no (,o,s,; -> Javascript (unable to call console.log(...)), no r for alert (if tio allowed it).

@Draco18s You don't need brackets for JavaScript since backtick and 6 are both legal, so you could do console.log`6` , the problem would be getting access to console.log since s isn't available

@BusinessCat I wasn't aware of that syntax. Neat. But yes, the o and s are still missing. And no a to try and fiddle things into an eval

7. Standard ML (MLton), 7 bytes
fun$n=6

Try it online! This declares a function $ which takes any argument and returns 6, eg. by calling with $().
New toolbox. Powershell is the newly added language.

Looking at the new toolbox...No (, no 1, no !, no E, no P, no s. The same characters that were precluding the other languages are still missing. :\

23. DStack, 5 bytes
222cK

Explanation
DStack is read in pairs and moves the cursor one char at a time, so the instructions become 22, 22, 22, and cK.
22  Multiplies register by 10 (initially 0), adds 2
22  Multiplies register by 10, adds 2
2c  Does nothing
cK  Displays number of the register

Try it online!
Next Toolbox

27. Assembly (x64, Linux, as)
.text
  .global _start
_start:
movl $len,%edx
movl $msg,%ecx
movl $1,%ebx
movl $4,%eax
int $0x80
movl $0,%ebx
movl $1,%eax
int $0x80
.data
msg:
.byte 0b110010,0b110110
len = . - msg

Try it online!
Explanation
I don't really know Assembly as, and information online seems hard to find ,so this is modified from the Hello World test on TIO.
The main issue here is that we lack the 2 byte, (turns out we did, but hey looks like I saved a 2 for the next answer) this makes it relatively hard to print 26.  We can't use raw ascii or even Hexadecimal (0x32) so I ended up using binary.
msg:
.byte 0b110010,0b110110

Tells it to output the two bytes 2 and 6.
Next toolbox

That looks so ugly for something as trivial as printing 26

I get a 2 when running the toolbox from either 25 or 26. You must have just forgotten to run it

This works xD

35. ELF 32-bit LSB executable (Linux), 48 bytes
0000000: 7f 45 4c 46 01 00 00 00 00 00 00 00 00 90 43 0d  .ELF..........C.
0000010: 02 00 03 00 19 90 43 0d 19 90 43 0d 04 00 00 00  ......C...C.....
0000020: b9 2e 90 43 0d b2 0d cd 80 cc 20 00 01 00 33 34  ...C...... ...34

I've done it! I have conquered the elusive ELF. ELF has been the first language in the list ever since the first toolbox. Now we can move on.
I've never used or even heard of ELF before, so this one was an adventure to figure out. I eventually copied much of Dennis' 32 bit Hello, World! program (64 bit version here). I modified it to print 33 and was able to remove a line of bytes.
Chars used: \x00\x01\x02\x03\x04\r\x19 .34CEFL\x7f\x80\x90\xb2\xb9\xcc\xcd
Try it online!
Next Toolbox

We have done 35/243 languages! Only 85.596707% more languages left!

18. C# (.NET Core), 33 bytes
()=>System.Console.WriteLine(17);

Try it online!
Next Toolbox

20. TRANSCRIPT, 45 bytes
You can see a Q here.
>SET Q TO 19
>X Q
>QUIT

Explanation:
TRANSCRIPT is designed to resemble interactive fiction scripts. So rather than using variables, objects and NPCs are used. Commands and dialog (essentially comments) are mixed together.
You can see a Q here.    Creates an object named Q
>SET Q TO 19             Assign Q to 19
>X Q                     Display Q
>QUIT                    End the program

Chars used: .19>EIOQSTUXYZacehnorsu
Try it online!
Next Toolbox

29. Pushy, TL#
TTTTTTTTTTTTTTTTTTTTTTTTTTTTL#

This pushes 10 to the stack 28 times, then gets the length of the stack and prints it.
Try it online!
Next toolbox

Great language name!

34. Java (OpenJDK 9), 63 bytes
interface a{static void main(String[]a){System.out.print(33);}}

I figured this was getting a bit too easy, with all the characters available and all...
Try it online!
Next toolbox

That's handy. I didn't know that when using an interface main doesn't need public and print doesn't need the full path! I was going to do class S{public static void main(String[]a){java.lang.System.out.print(33);}}, a whole 13 bytes more. Though if you named the interface S, then you would save a char.

Whoops, a was supposed to be lowercase

Yeah - I feel like the toolbox generator is adding too many chars each time.

@WheatWizard would you be able to modify the toolbox script to add back fewer chars? Adding 12 each time seems like too much because in most cases, we use less than 12 chars (except for Java that used 28).

@andrewarchi I think I will leave the character count on this question, I plan on doing a revamped version of this question with a lower character count and some more features to keep it interesting.

45. Templates Considered Harmful, Ad<T,>
Add<Add<Add<Add<Add<Add<T,T>,Add<T,T>>,Add<Add<T,T>,Add<T,T>>>,T>,Add<T,T>>,Add<Add<T,T>,Add<Add<Add<Add<T,T>,Add<Add<Add<Add<Add<Add<Add<T,T>,Add<T,T>>,Add<Add<T,T>,Add<T,T>>>,T>,Add<T,T>>,Add<Add<T,T>,Add<Add<Add<Add<T,T>,Add<T,T>>,Add<Add<T,T>,Add<T,T>>>,T>>>,T>>,Add<Add<T,T>,Add<T,T>>>,Add<T,T>>>>

Try it online!
Next Toolbox

9. JavaScript (Babel Node), 14 bytes
console.log`8`

Try it online!
Miraculously all the characters needed were available.
Next toolbox New language: pylons (Should be easy ;).

I am not sure how to get the link for the next toolbox though.

To get the next toolbox you can copy the last toolbox from the output section into the input section, and replace the number with your post id. (hit share it should be the number in the url starting with 126...) I've done it for you here.

@WheatWizard Cool. I thought so, but in trying to work it out I got interrupted by Real Life and it was easier to flail out a comment and wait for an edit. Thanks :)

4. Python 1 print+3
print+3

Try it online!
Next toolbox

10. Prelude, 3+!
We finally got an !!
3333333333333333333++++++++++++++++++!

Try it online!
Next toolbox
Explanation
9 is 57 in ASCII, which is 3 times 19.  So in order to get 9 we add 19 3s and use ! to output.

Two number 9s??

@OrphanBot Sorry this is number 10, still works though :)

11. Convex, 1 byte
A

Try it online!
Next toolbox

12. Logicode, 6 bytes
out 11

Try it online!
trivial, right language for 11
Next toolbox

Was fiddling with this to see if I could get it to print 11 as ascii characters rather than binary-11, couldn't get it to do them on the same line.

I am not sure your toolbox is correct. It is taking a post number of 26407 and your answer is actually 126407

does it looks correct now?

Yep. I hadn't noticed the discrepancy until after I did #13 and was getting its toolbox and I was like "hold on a moment..." And it totally invalidated the entry.

16. Scala, 13 bytes
()=>print(15)

Try it online!
Next Toolbox

17. 2sable (Prints 16)
4n

Try it online!
4  # Push 4
 n # Square it

Next Toolbox, new language: golfscript

22. MarioLANG, 44 bytes
+++++++++++++++++++++:
=====================

Boring but shortest.
Try it online!
Next Toolbox

Hah! You beat me by 13 seconds. I'll change mine to 23

24. Chez Scheme, 12 bytes
(display 23)

Try it online!
Next toolbox. Arcyóu is the new language.

+1 I was going to do (printf "23"), but yours is shorter

19. pbrain, 58 bytes
+++++++++++++++++++++++++++++++++++++++++++++++++.+++++++.

Prints ASCII values 49 and 56 (18).
Try it online!
Next toolbox

28. Haskell, 6 bytes
f x=27

Try it online! Declares a function f which takes any argument and returns 27.
Next toolbox:
['elf', 'logicode', 'visual-basic-net-mono', 'python2-pypy', 'silos', 'pushy', 'agony']
'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f!"#$%&\'()*+,-./1234569:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^`cdghijkopqrtuvwxz{|}~\x7f'

30. Visual Basic .NET (Mono), 9 bytes
MSGBOX 29

Pops up a system dialog box containing 29. Very similar to alert in javascript. It is case insensitive, but is usually written as MsgBox.
This can't be tested on TIO because MsgBox is a system window and that can't be seen online. The easiest way to test it is by pasting the code into a .vbs text file and running it on Windows. A .vbs file uses VBScript, a scripting version of VB that is very similar (MsgBox is the same between the two).
It's fun to use MsgBox again as that was the very first thing I ever programmed. In fifth grade, I made a series of MsgBox scripts to mess with friends.
Next Toolbox

31. Python 2 (PyPy), print-31
print--31-1

Try it online!
--31 is the same thing as 31, then -1 subtracts 1, making it 30.
Next toolbox

33. Minkolang, 9 bytes
"332"(O).

Try it online!
Next Toolbox
Never heard of this one before, I have no idea how it works. It just did weird stuff and I went "ok fine" and got it to print what I wanted. :D

38. Go, 20 bytes
First 20 byte Go solution on PPCG..? :P
func()int{return 37}

Try it online!
Next toolbox.

39. wsf, 58 bytes

Try it online!
Next toolbox

42. S.I.L.O.S, 8 bytes print 41
print 41

Try it online!
Little boring, but it works
Next toolbox

Welcome to SILOS

43. Logicode, 19 bytes
out @110100+@110010

Try it online!
Next toolbox

I didn't know that Logicode could output anything other than 1 and 0, I thought we were going to have to wait until 100.

@WheatWizard: Yeah, at a first glance I was thinking the same but discovered that it could :)

Well brainbool got added an it can't output anything other than 1 and 0 for sure.  So it looks like we are going to have to wait on that one.

@WheatWizard surely brainbool could output the correct number in base2? You said in the comments of the OP that outputting in a base other than 10 is acceptible if it's the standard way of outputting in that language

@Mayube Yes seems like it I forgot I said that.

@WheatWizard I attempted a solution at #7 (IIRC) that output the value in base 2. I just didn't have all of the symbols required (cough, out, cough). But yes, logicode can output ascii.

46. uBASIC, PRINt45
4PRINt45

I ran out of uppercase letters, so I used a lowercase t! I guess you could call it PRIN-t or Printy!
Try it online!
Next Toolbox

48. Racket, cake eating peril (#47)
#lang racket (print 47)

"Cake eating peril?!?", you might ask.
Well, if I said peak #7 in a rectilinear triple integral r(4) instead, then you'd all be confused and pinkcartgel() #47 just doesn't make sense, so cake eating peril (#47) was a natural choice. Plus, maybe Racket eats cake in it's free time. We'll never know.
It's no fun to say the chars you used sorted alphabetically. Anagrams are better. I'd suggest you do the same :).
Try it online!
Next Toolbox

54. ///, 2 bytes
53

Sorry for taking your numbers but there's really no better solution.
(oh wait, 5 and 3 got added to the toolbox again)
Try it online!
Next Toolbox

8. PowerShell Core, 1 byte
7

Try it online!
I had no idea what powershell is, but it turns out that 7 outputs 7 in TIO.
Next toolbox

56. Go
package main

import "fmt"

func main() {
   fmt.Println("55")
}

I learned this language just for this challenge. If I understood the challenge correctly, this should be valid.
Try it Online!
Next Toolbox

13. Pylons, 14 bytes
2+2+2+2+2+2+2,

Try it online!
Next toolbox
(We now have all the characters)

Could you have done 2+2+2... to save characters?

I don't understand the next toolbox, could someone please edit it in?

@WheatWizard The current toolbox contains 4 es, is there some bug in the implementation?

@Laikoni Yes there is you can count it as a single e.

14. CJam, 2 bytes
I'll try to be a bit more creative next time.
13

Try it online!
Next toolbox

Next character set: ABCDEFGHIJKLMNOPQRSTUVWWWWWWWWWWWWWXYZ What? 13 Ws?

Must be a bug in the python script

25. Arcyóu
24

Boring, but ¯\_(ツ)_/¯
Try it online!
Next Toolbox:
['elf', 'assembly-as', 'logicode', 'golfscript', 'visual-basic-net-mono', 'python2-pypy', 'silos']
'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f'

26. GolfScript, 2 bytes
25

GolfScript makes this way too easy.
It pushes 25 to the stack, then when the program ends, it prints the stack.
Try it online!
Next Toolbox
Available Languages

elf
assembly-as
logicode
visual-basic-net-mono
python2-pypy
silos
haskell

21. Turtlèd
"20"

Try it online!
Next Toolbox:
['elf', 'assembly-as', 'scheme-chez', 'logicode', 'golfscript', 'dstack', 'mariolang']
'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&\'()*+,-./123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f'

32. rk, 27 bytes
rk:start print: "31" rk:end

Chars used: "13:adeiknprst
The code is pretty self explanatory, but what surprised me is that rk was created by a 13 year old.
Try it online!
Next Toolbox

36. Foo, 10 bytes
&2+1$h&5$h

Try it online!
God I hope I understood this challenge correctly.
Chars used: $&+125h
Explanation
&2+1$h&5$h
&2          Set current cell to 2
  +1        Add 1 to current cell
    $h      Print as hexadecimal (i was taken so couldn't print as decimal
              thankfully 0-10 are the same in hex as in decimal)
      &5    Set current cell to 5
        $h  Print as hexadecimal

Next Toolbox
Looks like Go's on the menu now, hope to see something awesome from totallyhuman

now that I think about it perhaps I should've used up 7 and * instead of 1, 2 and +.

@totallyhuman Go is still there.

Ah, whoops. I was looking at the wrong section in the toolbox. ^^ And it seems I have every character I can possibly have...

37. Oasis, 36 bytes
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Try it online!
Next Toolbox

40. Reticular, 7 bytes
12+:9O;

Try it online!
Next toolbox

41. Random Brainfuck, 19 bytes
-[>+<-----]>+.----.

Try it online!
Next toolbox

44. D,  "().34;adeilmnoprstvw{}
import std.stdio;void main(){writeln("43");}

Try it online!
Next toolbox

47. Forth (forth-gforth), 46 .
46 .

Try it online
Well that was easy.
Next Toolbox

You used the input of 46's toolbox for your toolbox. I'll fix it for you

49. brainbool, 26 bytes +><.
+>+<.>.>.>.>.>.

Try it online!
Outputs 110000, which is 48 in base 2
Next toolbox

50. Kotlin, 4 bytes
->49

Try it online!
Next toolbox.

51. Unlambda, `.05i
`.0`.5i

Try it online!
Next Toolbox

52. Factor, 17 bytes
USE: io
"51"print

Try it online!
Next toolbox

53. Actually, 6DP*
6DP6DD*

Try it online!

6       push 6
 D      pop 6, push 6-1=5
  P     pop 5, push the 5th prime = 13
   6DD  push 6-1-1=4
      * pop 13 and 4, push 13*4=52

Next toolbox

55. Agony
+++++++++++++++++++++++++++++++++++++++++++++++++++++.-.

I don't really get this language, but it seems to be a superset of brainfuck.
Try it online!
Next toolbox


text:
Quote my quote!
A quotation is "the repetition of one expression as part of another one". In American English, a quotation is surrounded by double-quotation marks ("), as in the previous sentence. However, this rule differs when a quote appears inside another quote. In this case, the inner quote is surrounded by single-quotation marks (').
Challenge
Given a string as input, output a quotable version of that string by exchanging double- and single-quotation marks that are used for inner quotation.
There's just one catch, though - not all single-quotation marks are used for quotation! For this challenge, single-quotation mark is used for  quotation if and only if:

The mark is preceded by a non-alphanumeric character, or
The mark is followed by a non-alphanumeric character that is not a space

The marks used for quotations are guaranteed to be balanced; that is, you do not need to handle invalid input. Additionally, double-quotation marks will only be used in situations where single-quotation marks can be used to represent quotation.
Test Cases
A man, a plan, a canal, Panama.
"A man, a plan, a canal, Panama."

Socrates once said, "An unexamined life is not worth living."
"Socrates once said, 'An unexamined life is not worth living.'"

@musicman523 said, "Socrates once said, 'An unexamined life is not worth living.'"
"@musicman523 said, 'Socrates once said, "An unexamined life is not worth living."'"

"Nested 'quotes "can 'cause "recursion," if,' it," runs,' deep!"
"'Nested "quotes 'can "cause 'recursion,' if," it,' runs," deep!'"

"Contractions' behaviors can't be easy to account for," he warned.
"'Contractions' behaviors can't be easy to account for,' he warned."

@carusocomputing said, "Nested, 'quotes, it's unfortunate', to be sure."
"@carusocomputing said, 'Nested, "quotes, it's unfortunate", to be sure.'"

Scoring
This is code-golf, so the shortest answer in each language wins!

Sandbox

... if' it" runs' deep" has single-quotes that are not preceded by a non-alphanumeric, nor are they followed by "non-alphanumeric character that is not a space", and yet they are being transformed!

@ValueInk Good catch! I updated the rules about single quotes after writing the test cases and didn't fix that one. It's been updated now.

Personally I don't feel that handling apostrophes adds much of value to the challenge.

@ATaco Personally, my rationale for coming up with challenge ideas is to make problems difficult enough that many different solution methods will appear, and it is more the solution that gets golfed rather than finding the right tool for the job. This is the value of adding this extra bit to the challenge IMO

So, I heard her say "We took place of the Jones'; they took the place of the Simths'." should become "I heard her say 'We took place of the Jones"; they took the place of the Simths".'" by these rules?

@JonathanAllan Yes. I think it's difficult to determine whether those single-quotation marks are used for quotation or possession without deeply complicating the rules. I think that would make a decent challenge on its own.

"Nested, 'quotes, it's unfortunate', to be sure." - I think you need a nested case with contractions.

@carusocomputing Thank you! I just added your test to the post.

@musicman523 I think there's 2-3 answers invalidated by that case, the ruby and retina ones are gold though.

@carusocomputing Actually, I don't think the Retina answer quite works either. See my comment on that answer.

Ruby, 64 66 65 64+1 = 65 67 66 65 bytes
+1 byte for the -n flag.
gsub(/"|(?<!\w)'|'(?!\w|\s)/){"'\""["\"'".index$&]}
$><<?"+$_+?"

Try it online!

Doesn't seem to do the right thing for single-quotation marks preceded by a space (which are indeed used for quotation)

@musicman523 thanks, fixed!

Retina, 34 27 bytes
-7 bytes thanks to @Leo
T`'"`"'`\W'|"|'[^\w ]
^|$
"

Try it online!

With @carusocomputing said, "Nested, 'quotes, it's unfortunate', to be sure." as the input, the single-quote following unfortunate is not changed to a double-quote, but should be. If it helps you debug, it works when the comma comes before the quote. (I don't know Retina so I can't really help any further.)

@musicman523 fixed it

You can use \w directly inside your character class

JavaScript (ES6), 90 bytes
Assumes the string doesn't contain #.
s=>'"'+s[r='replace'](/"/g,'#')[r](/(\W)'/g,'$1"')[r](/'([^\w ])/g,'"$1')[r](/#/g,"'")+'"'

f=
s=>'"'+s[r='replace'](/"/g,'#')[r](/(\W)'/g,'$1"')[r](/'([^\w ])/g,'"$1')[r](/#/g,"'")+'"'
;

`A man, a plan, a canal, Panama.
Socrates once said, "An unexamined life is not worth living."
@musicman523 said, "Socrates once said, 'An unexamined life is not worth living.'"
"Nested 'quotes "can 'cause "recursion," if,' it," runs,' deep!"
"Contractions' behaviors can't be easy to account for," he warned.
@carusocomputing said, "Nested, 'quotes, it's unfortunate', to be sure.`.split(`\n`).map(f).map(s=>console.log(s))

source: Stack Exchange

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

sort: votes


text:
Draw A Reuleaux Triangle!
The Reuleaux triangle is the shape formed by the intersection of three circles, with each circle passing through the others' centers. Regardless of rotation, a Reuleaux triangle's width will always equal the radius of the circles:

Image: Wolfram MathWorld
Write a program that takes a width r as input and displays a Reuleaux triangle of that width (in pixels).
You must display the shape in isolation, i.e. solid-filled, un-stroked, and over a solid-filled background.
code-golf - Shortest program in bytes wins.

Should the radius r be in pixels or just some scaling factor?

@Karl Napf Pixels.

Can we output anything to STDOUT, as long as we draw the Reuleaux triangle properly?

@EriktheOutgolfer That is fine.

JavaScript + HTML, 164 158 + 13 = 171 bytes

w=+prompt(f=(x,y)=>x*x+y*y<w*w);C.width=C.height=w*2;for(y=-w;++y<w;)for(x=-w;++x<w;)f(x,y)&f(w-x,y)&f(w/2-x,y-w*.866)&&C.getContext`2d`.fillRect(x+w,y+w,1,1)
<canvas id=C>

I don't know why I enjoy answering these mathy drawing challenges with <canvas> so much...

Love2D, 320 bytes.
j=math.rad(60)i="increment"m=math s=m.sin C=m.cos g=love.graphics f="fill"S=g.stencil function love.draw()r=arg[2]c=function(x,y)return function()g.circle(f,x,y,r,r*4)end end X=r/2 Y=0 S(c(X,Y),i,1)S(c(X+C(j)*r,Y+s(j)*r),i,1,true)S(c(X-C(j)*r,Y+s(j)*r),i,1,true)g.setStencilTest("greater",2)g.rectangle(f,0,0,2*r,2*r)end

Probably not the optimal solution, it uses Love2D's stencils, setting up the 3 circles, and filling in over where they intersect.
Call via the command line, like love tri.love 256
Example Output

It's quite lovely

Python 2, 111 bytes
from turtle import*
r=input()
ht()
begin_fill()
c=circle
c(r,60)
seth(120)
c(r,60)
seth(240)
c(r,60)
end_fill()

Mathematica 101 100 98 Bytes
Taking a different approach than @MichaelSeifert, and probably interpreting this a little more literally with regard to the pixel clause:
Image@Boole@Table[And@@(({x,y}∈#~Disk~2)&/@{{0,c=√3},d={1,0},-d}),{x,-1,1,2/#},{y,c-2,c,2/#}]&

Usage Example:
%@10

10 pixels

50 pixels

100 pixels

Saved a byte thanks to @MartinEnder (infix notation) and another 2 bytes by defining d.

PostScript, 96 86 85 75 73 72 bytes
dup(^@^^Z<^@Z<){sin mul exch dup}forall
0 1 2{newpath 369 arc clip}for fill

Takes the input as a value on the stack. ^^ and ^@ represent literal control characters. (^@^^Z<^@Z<) is the string of characters with code points 0, 30, 90, 60, 0, 90, and 60, respectively. Those are then interpreted as angles in degrees, because obviously that’s what code points are for.
Saved 10 bytes because closepath isn’t needed (both clip and fill implicitly close the path).
Saved 1 byte by using repeat instead of defining a function.
Saved 10 bytes by switching to a completely different approach.
Saved 2 bytes by doing tricks with the stack.
Saved 1 byte by using 0 1 2{}for instead of 3{}repeat.

TeX/TikZ, 128 121 112 bytes
\input tikz\footline{}\tikz\draw[draw=none,fill=red](0,1)\foreach~ in{1,2,3}{[rotate=~*120]arc(0:60:\r pt)};\bye

The code is based on this answer at TeX.se.
TeX is vector-based, so doesn't do pixels.  The radius is a float with a maximum of about 15 before it hits the edge of the page.  It's also not really built for commandline input, so need to be run as
pdftex  "\def\r{2} \input rt.tex"

where the code above is saved in rt.tex

A few tips to make this shorter: you don't need any of the newlines; you don't need .tex; \footline{} is just as good as \nopagenumbers; use ~ as a variable name instead of \i. To satisfy the “pixel” requirement, you could use \r sp; 1sp is the sort-of equivalent to a pixel for TeX since it's the finest location TeX can manage (I don't know if it applies to tikz though).

@Gilles I can't get anything with sp but I think pt is a good idea.  All your other ideas worked (some hadn't seemed to in my tests). Thank you

You can remove the space after ~ to save one more byte. \input tikz\footline{}\tikz\draw[draw=none,fill=red](0,1)\foreach~in{1,2,3}{[rotate=~*120]arc(0:60:\r sp)};\bye works for me. Try pdftex  "\def\r{2000000} \input rt.tex" — at 2sp finding the shape visually would be difficult given how small it is.

@Gilles I must admit I only went up to 20000 sp.

1pt = 65536sp so 20000sp is still tiny.

You can save at least 25 bytes:
\input tikz\def~#1{{[rotate=#1*60]arc(0:60:\r pt)}}\footline{}\tikz\fill(0,)~2~4~6;\bye.
You can save one byte more by calling the input parameter \1 instead of \r, saving you the space: \input tikz\def~#1{{[rotate=#1*60]arc(0:60:\1pt)}}\footline{}\tikz\fill(0,)~2~4~6;\bye. I'd also say, but this is my personal opinion, that you do not really need \footline{} as it does not say "nothing but" the triangle. Anyways, this is a matter of taste. :-)

PHP+SVG, 165 bytes
<?$h=3/8*$w=2*$d=2*$r=$_GET[0];$q=$r+sqrt($r**2-($r/2)**2);echo"<svg width=$w height=$w><path d='M$r,$r A$r,$r 0 0 1 $d,$r A$r,$r 0 0 1 $h,$q A$r,$r 0 0 1 $r,$r'/>";

Example Output for Input 128

<svg width=512 height=512><path d='M128,128 A128,128 0 0 1 256,128 A128,128 0 0 1 192,238.85125168441 A128,128 0 0 1 128,128'/>

Mathematica, 134 131 bytes
N.B. This solution is no longer valid, as the question was later edited to require r to be measured in pixels.  Thanks to Martin Ender for helping me shave off a few bytes in the comments.
r=Input[];RegionPlot[And@@((Abs[y+I x-#]^2<3r^2)&/@Table[Exp[2n I/3Pi]r,{n,3}]),{x,-1,1},{y,-1,1},Frame->False,BoundaryStyle->None]

The input value must be scaled between 0 and 1 for this code to work.  Note that almost a quarter of this code is required to display the shape "in isolation", as this is not Mathematica's default.

Welcome to PPCG! r Exp[2 I Pi n/3] can be Exp[2I n/3Pi]r to save some spaces. And it's generally shorter to write an unnamed function, i.e. drop the r=Input[];, replace r with # and append a &.

I think the input has to be pixels, not a scaling factor.

@pycoder:  Yes, that constraint was edited in after I posted my solution.

BBC BASIC, 58 bytes
I.r:L.r,r,r,r:F.i=0TO9S.PI/1.5PLOT177,r*COS(i),r*SIN(i)N.

Download interpreter at http://www.bbcbasic.co.uk/bbcwin/download.html
Ungolfed
INPUTr                       :REM input a radius
LINEr,r,r,r                  :REM draw a line of length 0 from r,r to r,r to establish a cursor history away from the corner of the screen
FORi=0 TO 9 STEP PI/1.5      :REM in steps of 120 degrees (going round and round the three sides of an equilateral triangle)
  PLOT177,r*COS(i),r*SIN(i)  :REM move relative by r*COS(i),r*SIN(i) and draw a sector with arc between new and last graphics cursor positions,
NEXT                         :REM with the centre of the arc at the penultimate graphics cursor position.

Wow, that's practially a built-in!

GLSL, 298 229 characters
precision lowp float;
uniform vec2 resolution;float r=100.;void main(){vec2 p=gl_FragCoord.xy-resolution.xy/2.;float h=sqrt(3.)/4.*r;gl_FragColor=vec4(length(p+vec2(r/2.,h))<r&&length(p+vec2(-r/2.,h))<r&&length(p-vec2(0.,h))<r);}

Try it here
Bonus

Radius can be set by changing r variable
Triangle width is in pixels as requested (you have to make zoom is set to 1x in GLSL sandbox).

Does GLSL have a standard input method you could use?

In glslsandbox, it is possible to get mouse cursor position. This could be used to control triangle radius (eg : radius would be mouse distance from center).

Java + Processing, 95 bytes
noStroke();arc(r,r,r,r,0,PI/3);arc(r+r/2,r,r,r,2*PI/3,PI);arc(r+r/4,r+r/2.3,r,r,4*PI/3,5*PI/3);

Takes input as variable r, outputs a Reuleaux triangle at \$(r,r)\$, given an adequately sized canvas.
Code
As a function with size call, 124 bytes
void a(int r){size(r*2,r*2);noStroke();arc(r,r,r,r,0,PI/3);arc(r+r/2,r,r,r,2*PI/3,PI);arc(r+r/4,r+r/2.3,r,r,4*PI/3,5*PI/3);}

Outputs
50

100

200

JavaScript (ES6) + HTML, 196 + 13 = 209 bytes
Uses a path-based approach instead of a pixel-filling approach.
r=>{c.width=c.height=r*2
with(Math)with(c.getContext`2d`)scale(e=r*.578,e),beginPath(a=s=>s*PI/3),moveTo(2,1),[2,4,6].map(s=>arcTo(cos(i=a(s-1))+1,sin(i)+1,cos(j=a(s))+1,sin(j)+1,sqrt(3))),fill()}

<canvas id=c>

f=
r=>{c.width=c.height=r*2
with(Math)with(c.getContext`2d`)scale(e=r*.578,e),beginPath(a=s=>s*PI/3),moveTo(2,1),[2,4,6].map(s=>arcTo(cos(i=a(s-1))+1,sin(i)+1,cos(j=a(s))+1,sin(j)+1,sqrt(3))),fill()}

f(200)

//r=>{c.width=c.height=r*2
//with(Math)with(c.getContext`2d`)translate(r,r),scale(r,r),beginPath(a=s=>s*PI/3),S=sqrt(3),moveTo(1/S,0),[2,4,6].map(s=>arcTo(cos(i=a(s-1))/S,sin(i)/S,cos(j=a(s))/S,sin(j)/S,1)),fill()}

//r=>{c.width=c.height=r*2
//with(Math)with(c.getContext`2d`)translate(r,r),scale(r,r),beginPath(),P=PI/2,A=(s,_)=>(_?sin:cos)(s*PI/3)/sqrt(3),moveTo(A(0),0),[2,4,6].map(s=>arcTo(A(s-1),A(s-1,1),A(s),A(s,1),1)),fill()}
<canvas id=c>

Logo, 53 bytes
to t :r filled 0[repeat 3[arc 60 :r fd :r rt 120]]end

uses the filled command to fill the shape in colour 0 (black.) The code in the outer  square brackets is executed without any line being drawn, but Logo keeps track of the turtle movements and fills in the shape once the bracket is exited.
Logo, 64 61 bytes
to t :r repeat 3[pd arc 60 :r pu fd :r rt 120]fd 9 fill end

Pen Down, draw 60 degree arc with turtle at the centre, Pen Up, move pen to start of arc, turn 120 deg.
Repeat 3 times, then move inside the shape and fill it.
Try at http://turtleacademy.com/playground/en
Call like cs ht t 100 (clear screen, hide turtle, t with r=100.)

MATL, 35 bytes
9Bo&ZQ*3X^/G_G&:t!J*+8L&!-|G<A&e0YG

This produces a file called image.png. For input r, the size of the image is 2*r+1, and the width of the triangle is r as required.
Try it at MATL Online! The online interpreter automatically opens the created file and displays the image with arbitrary scaling; click on it to obtain the actual-size version.
Alternatively, here are two example outputs from the offline compiler running on Matlab,  with inputs 50 and  100. The last part of the code 0YG has been replaced by IYG so that the figure is directly displayed (with the right size) instead of written to a file.

Explanation
9B      % Push 9 in binary: [1 0 0 1] with logical values
o       % Convert to double
&ZQ     % Roots of polynomial with coefficients [1 0 0 1], as a 3×1 column vector
*       % Multiply by implicit input r
3X^/    % Divide by sqrt(3). This gives a 3×1 vector with the circle centers
G_G&:   % Push row vector [-r -r+1 ... r-1 r], with size 1×(2*r+1)
t!J*    % Duplicate, transpose, multiply by 1j
+       % Add with broadcast. This gives a (2*r+1)×(2*r+1) 2D-array of complex
        % numbers, which defines the pixel grid
8L      % Push [3 1 2]
&!      % Permute dimensions as indicated. This gives a 1×(2*r+1)×(2*r+1) 3D-array
-|      % Subtract with broadcast. Absolute value. This gives a 3×(2*r+1)×(2*r+1)
        % 3D-array with the distance from each circle center to each grid point
G<      % Less than r? Gives a 3×(2*r+1)×(2*r+1) 3D-array containing true or false
A       % All: this gives a 1×(2*r+1)×(2*r+1) array containing true for
        % columns of the original 3D-array that contained all true values
&e      % Squeeze the first singleton dimension to give a (2*r+1)×(2*r+1) 2D-array
0YG     % Save as image file with default file name

JavaScript (ES6) + SVG (HTML5), 28 + 102 = 130 bytes

f=
n=>s.setAttribute('width',n)
<input type=number value=82 oninput=f(this.value)><br>
<svg id=s width=82 viewbox=0,0,82,82><path d=M0,71a82,82,0,0,0,82,0A82,82,0,0,0,41,0A82,82,0,0,0,0,71>

Byte count excludes code needed for convenient user input of desired size.

Clever! n=>s.style.width=n would work also.

I can't seem to figure out how you came to 112 bytes.

@darrylyeo That suggestion didn't work for me, sorry, but I agree about the byte count, I can't figure out how I came to it either.

Hmm, probably only works in Chrome.

MetaPost (242 226 Bytes)
outputtemplate:="%j-%c.ps";
prologues:=1
beginfig(1);
 len:=1cm;
 path p[];
 p[1]:=len * dir -30 {dir 90} .. len * dir  90;
 p[2]:=p[1] rotated 120;
 p[3]:=p[1] rotated 240;
 fill p[1] -- p[2] -- p[3] -- cycle;
endfig;
end.

It may be possible to reduce this somewhat, I'm new to metapost.

I was a bit lazy and used the text editors byte count. I didn't know you could remove the colons, Thanks. I literally have an hour of MetaPost under the belt now ^_^

I still count 223, not 226. Also, can you remove the spaces in len * dir and the dot at the end?

k, 141 100 98 bytes
s:*/2#;l:2*r:.:0:`
`0:(,"P1")," "/'$(,l,l),&/{(s'n+x)</:(s r)-s'y+n:r-!l}./:r*%(0 0;4 0;1 3)%4
\\

Input is taken from stdin, output is stderr (or stdin depending on the interpreter) in pgm format. For example:

Explanation:
s:*/2#               /set s to a squaring function
r:.:0:`              /get user input, set to r
l:2*                 /width/height is 2 times r
r*%(0 0;4 0;1 3)%4   /the coordinates of circle centers
{ }./:               /for each coordinate pair (x, y) get a circle
                     /function to get a circle:
n:r-!l               /  set n to {r, r-1, ..., -(r-1)}
(s'n+x)</:(s r)-s'y+ /  use b^2<r^2-a^2 on all points to get a circle
                     /  where x and y shift the circle right and down
&/                   /get intersections of circles (fold binary and)
(,l,l),              /prepend height and width for PGM format
" "/'$               /convert to string, add spaces
(,"P1"),             /prepend PGM header
`0:                  /output to stderr
\\                   /exit

OpenSCAD, 91 bytes
module t(r){intersection_for(t=[0,120,240]){rotate(t)translate([r/sqrt(3),0,0])circle(r);}}

I'm not sure how kosher this is, as pixels aren't really a well-defined unit in any mesh grid formats that I know of. In stead, the module t draws a reuleaux triangle of given radius r in whatever native units are in use.
Sample preview output for t(100):

05AB1E, 66 bytes
’)
¨€(ÿ,60)
lt(60’Ð’€š éà £Ø*
ht()
ï…_œã(ÿÿÿ)
„–_œã()
„ˆ 1:ht()’.e

Can't use TIO, since it opens a window and draws the Reuleaux triangle there.
Asks for input, and then opens up a Python turtle window drawing the triangle.
Jonathan Allan's answer gave me the inspiration to do this, although I altered his code a bit.
Essentially, this is a combination of 05AB1E's compressing capabilities and Python's ease of turtle graphics.

SmileBASIC, 87 86 85 83 82 81 79 78 77 76 75 bytes
INPUT R
C.5Y=R*.87C 1C.GPAINT.,0DEF C X
A=X*240GCIRCLE R*X,Y+2,R,A-60,A
END

Ungolfed:
INPUT RADIUS
CIRCLE 0.5
Y=RADIUS*(SQR(3)/2)
CIRCLE 1
CIRCLE 0
GPAINT 0,0
DEF CIRCLE X
 ANGLE=X*240
 GCIRCLE RADIUS*X,Y+2,RADIUS,ANGLE-60,ANGLE
END

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

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


text:
How many dice can you roll without rolling the most probable number
Problem
Starting from n=2 dice:

Roll n dice, with each number 1 to 6 equally likely on each die.
Check if their sum equals the most probable sum for n dice, that is 3.5*n.

If they're equal, terminate.
Otherwise, print n, and repeat from the start with n+2 dice

Your code doesn't have to do this procedure exactly, but should give random output probabilistically equivalent to it, based on our definition of randomness.
Your program should output all of the numbers on their own line; for example, if the program got up to 8 dice and rolled the most probable number with 8 dice, the output would be:
2
4
6

Example Run
On 2 dice, 7 is the most probable sum. Let's say the numbers rolled were 2 and 3. Then, you would print 2.
On 4 dice, 14 is the most probable sum. Let's say the numbers rolled were 3, 4, 2, and 5. Then, the sum is 14, so the program would terminate here.
The final output in this case is "2".
Rules

code-golf so shortest solution in bytes wins
Standard Loopholes Apply
The meta definition of randomness applies
You may use functions as well as programs

This answer, as it stands, is very unclear. Is there input, or is it meant to generate the output from no input as a loop? Is there any randomness? I don't seem to see any randomness involved.

By the way, welcome to PPCG! :)

Thank you, Sorry I am very new to this. What would make it more clear? There is no input, you are supposed to start with one die and work your way up as high as you can.

@pudility So if I understand correctly, I am supposed to keep outputting 2, 4, 6, 8, ... an roll that many dice each time until I hit the most probable number for that iteration?

Yes, that is correct.

Thank you for taking the time to edit your challenge based on our feedback! For the record, we have a place where you can post challenges to work out some of the details before posting: the sandbox.

I think I understand the challenge instructions now, though it took me some time to digest. Would it be OK to simplify things and just say to try even numbers of nice?

I think that it would be easier just to leave it how it is now. If you think that it is really important, I can change it. But I think that it makes more sense how it is currently written. Thank you for the suggestion though.

@pudility I'll give a try at a general cleanup edit, and you see what you think.

@pudility I made some edits. Feel free to change things back. I tried to avoid changing any rules, but I do want to suggest allowing a freer output format. In particular, the default is to allow functions as well as programs, which may output (say as a list) rather than print. See this advice on things to avoid.

I added you may use functions as well as programs

The probability of getting the most probable number with 2n dice is A063419(n)/(6^(2n)).

I have asked here if some of the current answers that follow a slightly different approach are valid.

Please do not accept answers when there are shorter answers in too.

Python 2, 70 bytes
from random import*
n=2
while eval("+randrange(6)-2.5"*n):print n;n+=2

Try it online!
The trick is to compute the sum by evaling a string the looks like
'+randrange(6)-2.5+randrange(6)-2.5'

with n copies of the expression concatenated. The randrange(6) outputs a random number from [0,1,2,3,4,5], which is shifted down by 2.5 to have average of 0. When the sum if 0, the while condition fails and the loop terminates.
An alternative using map was 4 bytes longer:
from random import*
n=2
while sum(map(randrange,[6]*n))-2.5*n:print n;n+=2

I've found a bunch of equal-length expressions for a die shifted to mean zero, but none shorter
randrange(6)-2.5
randint(0,5)-2.5
randrange(6)*2-5
uniform(-3,3)//1

I like this one! Mainly because it is the only one that I understand.

MATL, 13 bytes
`@E6y&Yrs@7*-

Try it online!
Explanation
`       % Do...while top of the stack is truthy
  @E    %   Push 2*k, where k is the iteration index starting at 1
  6     %   Push 6
  y     %   Duplicate 2*k onto the top of the stack
  &Yr   %   Array of 2*k integers distributed uniformly in {1, 2, ..., 6}
  s     %   Sum
  @7*   %   Push 7*k
  -     %   Subtract
        % End (implicit). If the top of the stack is non-zero, the loop
        % proceeds with the next iteration. Else the loop is exited.
        % Display stack (implicit)

Jelly,  19  14 bytes
-5 bytes with help from Leaky Nun (moving from count up to recursion)
‘‘6ṗX_3.L⁶S?Ṅß

A full program printing the results separated by newlines (an extra space and newline are also printed, and the program errors at the end).
Try it online!  - any time 6 dice are surpassed TIO kills this due to memory usage, but it works in principle - it also takes ~40s to do so.
A more friendly 15 byte version that does not take so long or require so much memory is available here.
How?
Recursively rolls 2 more dice until the sum of the faces each reduced by 3.5 is zero, printing the number of dice as it goes, when the zero is reached it attempts to use a space character causing a type error.
‘‘6ṗX_3.L⁶S?Ṅß - Main link: no arguments (implicit left=zero)
‘              - increment (initial zero or the previous result)
 ‘             - increment  (= # of dice to roll, n)
  6            - literal 6
   ṗ           - Cartesian power - all possible rolls of n 6-sided dice with faces 1-6
    X          - pick one of them
      3.       - literal 3.5
     _         - subtract 3.5 from each of the roll results
           ?   - if:
          S    -          sum the adjusted roll results (will be 0 for most common)
        L      - ...then: length (number of dice that were rolled)
         ⁶     - ...else: literal ' ' (causes error when incremented in next step)
            Ṅ  - print that plus a newline
             ß - call this link with the same arity (as a monad with the result)

Wow, that is very few bytes. Well done! I am holding off on accepting it until a few more people answer.

Yeah it is normal to wait quite a while before accepting, even if ever doing so. Many people give it a week or two.

also, you are supposed to output all of the iterations - not just the last one.

Oh, I answered an old edit - that completely changes it, I cant use this method in many many ways.

Oh wait just the ns, OK maybe it's salvageable. I thought you meant the sums :)

Yeah, Many edits where made. Sorry for the confusion.

18 bytes

Alternative 18 bytes

17 bytes

16 bytes (terminates with error)

15 bytes (trailing newline -> space -> newline, terminates with error)

Note that changing 6ẋX€ to 6ṗX will save a byte, albeit making the program much slower (complexity changes from O(n) to O(6^n))

@LeakyNun Oh wow, a lot to digest here! I did think there would be savings...

@JonathanAllan I left the central part of the program unchanged: 6ẋX€_3.S

So you used ‘‘ so that you won't have to insert a space in +2 6ṗ...huh?

@EriktheOutgolfer I think 2+6ṗ... will work just as well. Edit, hmm, nope.

@JonathanAllan Yeah that's equivalent to 8ṗ.

@EriktheOutgolfer Not exactly - it depends on the rest of the chain how it acts. (e.g. 2+6ẋ on it's own will yield [8,8] not [])

@JonathanAllan Although 8ṗ2 isn't what you want here. Basically 2+6ṗ is (2)[(+)(6)](ṗ)[2]...you see how badly it progresses, while ‘‘6ṗ is (‘)(‘){(6)(ṗ)}, which just seems optimal, and ‘‘ still adds adds 2 like +2 does, except +26ṗ will progress like [(+)(26)](ṗ)[v] where v doesn't have the correct value by itself, and only adding a space will fix it (+2 6ṗ progresses like [(+)(2)]{(6)(ṗ)}), but nobody is in the mood of adding an extra space if they can so something else. ;)

TI-BASIC, 28 bytes
2→N
While mean(randInt(1,6,N)-3.5
Disp N
N+2→N
End

Explanation

randInt(1,6,N) generates a list of N random numbers from 1 to 6
mean(randInt(1,6,N)-3.5 gets the average of the rolls shifted down by 3.5
While continues until the average expression equals zero (the most probable sum)

R, 49 bytes
n=2
while(sum(sample(6,n,T)-3.5)){print(n)
n=n+2}

sample(6,n,T) generates n (pseudo)random samples from the range 1:6 with replacement. Subtracting 3.5 from each element yields a result whose sum is 0 (falsey) if and only if it's the most common value.
Try it online!
Skips the odd dice rolls.

This seems to output 80 every time for me, possible bug?

@pudility you can add spaces at the end to try it again; it's caching the inputs/code snippet each time

@Giuseppe You can disable the cache in TIO under Settings.

after I disabled the cache like @xnor said, It worked very well. Thanks for the answer!

@xnor who knew! Good to know in the future.

Java 8, 123 149 113 108 bytes
()->{for(int n=0,s=1,i;s!=n*7;){for(i=s=++n*2;i-->0;s+=Math.random()*6);if(s!=n*7)System.out.println(n*2);}}

Or 107 bytes if we use an Object null as unused parameter instead.
+26 bytes for a bug-fix, correctly pointed out by @Jules in the comments.
-41 bytes thanks to @OliverGrégoire's great thinking!
Explanation:
Try it here.
()->{                           // Method without parameter nor return-type
  for(int n=0,                  //  Amount of dice
          s=1,                  //  Sum
          i;                    //  Index
      s!=n*7;){                 //  Loop (1) as long as the sum doesn't equal `n`*7,
                                //  because we roll the dice per two, and 3.5*2=7
    for(i=s=++n*2;              //   Reset both the index and sum to `n`*2,
                                //   so we can use random 0-5, instead of 1-6
                                //   and we won't have to use `+1` at `Math.random()*6`
        i-->0;                  //   Inner loop (2) over the amount of dice
        s+=Math.random()*6      //    And increase the sum with their random results
    );                          //   End of inner loop (2)
    if(s!=n*7)                  //   If the sum doesn't equal `n`*7
      System.out.println(n*2);  //    Print the amount of dice for this iteration
  }                             //  End of loop (1)
}                               // End of method

I think there is an error in the function. If r equals 3.5*n the program should terminate directly. But, if I understand the function correctly, it would print n one last time before terminating.

@raznagul Actually, it wasn't printing an additional time. It was however bugged. What it did before: random 1-12 (bug 1: should have been 2-12); check if this equals 7: if it is: we're done without printing; if it is not: roll 2 dice again (bug 2, should have been 4 dice instead of 2 again); then print 2, and raise n by 2. So it did contain two bugs (1-12 instead of 2-12; and rolling dice like 2 -> 2 -> 4 -> 6 -> ..., instead of 2 -> 4 -> 6 -> ...). It was printing correctly however, because it wouldn't have gone to System.out.println(n),n+=2 if r was indeed equal to 3.5*n.

"Roll two dice at once, by picking a random number from 2-12" -- this is not probabilistically equivalent to rolling two dice and adding the numbers as required in the question, therefore is not a correct solution.

Just to explain the comment of Jules, when rolling "uniformly" from 2 to 12, you have 1 in 11 chances to get 12. When rolling 2d6, you have 1 in 36 chances to get 12.

Shorter by a few bytes (113), but probably still golfable: ()->{for(int n=2,s=0,e=7,i;s!=e;n+=2,e+=7){for(i=n,s=n;i-->0;)s+=Math.random()*6;if(s!=e)System.out.println(n);}}. Also, correct in regards to Jules' comment and my explanation. n is dices, s is sum, e is expected, i is index. Finally, the sum starts with n to avoid a +1, n times, and s!=e is repeated because I just don't know how to avoid that case.

Also, you can use Runnable instead of defining your own interface in the TIO ;)

@OlivierGrégoire I indeed know I can use Runnable, but personally I use an interface unless I use currying. Kinda personal preference. As for your code: very nice and smart thinking! I almost feel like I should delete my answer and you should post yours.. Great job!

I golfed it a bit again ;) ()->{for(int i=0,s=1,j;s!=i*7;){for(j=s=++i*2;j-->0;)s+=Math.random()*6;if(s!=i*7)System.out.println(i*2);}}

R, 48 44 42 bytes
A 5-byte improvement on Giuseppe's answer.
while(sum(sample(6,F<-F+2,1)-3.5))print(F)

This (ab)uses the fact that F is a variable by default assigned to FALSE which coerces to 0 and can then be incremented, saving us the need to initialize a counter variable.

of course, you can save two bytes by calling sample(6) instead of sample(1:6) but crossed out 44 is still 44.... https://codegolf.stackexchange.com/a/82343/67312

@Giuseppe Of course, thanks! I've edited the answer now.

05AB1E, 22 20 bytes
-2 Bytes thanks to Emigna
[YF6L.RO}7Y*;ïQ#Y=ÌV

Try it online!
Explanation
[YF6L.RO}7Y*;ïQ#Y=ÌV
[                    # Infinite loop start
 YF     }            # Y times... (Y defaults to 2)
   6L.R               # Push a random number between 1 and 6 (why does this have to be so looooong ._.)
       O              # Sum
         7Y*;ï       # Push 3.5 * Y as an int
              Q      # Is it equal to 3.5 * Y?
               #     # If so: Quit
                Y    # Push Y
                 =   # Print without popping
                  ÌV # Set Y to Y + 2

If you move O after .R you can remove ) and s.

PHP, 75 bytes
for($d=2;(++$i*7/2-$r+=rand(1,6))||$i<$d;)$i%$d?:$d+=1+print"$d
".$r=$i="";

Try it online!

5^2/++$i*$d+=rand()%6 is a slightly shorter condition for the loop. Also I think the current loop incorrectly exits if the very first "dice" rolled is a "1" (it generates a 0 for the initial $d).

@user59178 Nice Idea but it could be make a division by zero error so I must modified it. You are right my solution before stops in this case which is wrong.

Your 45-byte answer is invalid because the resulting distribution is not the same as in the question, see here. Your 42-byte answer is, I think, also using the wrong distribution; it seems to assume for example that for two dice, it is equally likely to have 2 and 7 as the sum.

@Pakk Yes the 45 Byte answer is invalid. I think your thinking is false what happens at the 42 Byte Version. Look at am expanded version Try it online!

@JörgHülsermann That expanded version confirms what I say. In a proper implementation, the value of $r/$i should become closer to 3.5 for bigger values of $i, but I don't see that happening at all. I got an average of 1.16 for 9984 dice, that is statistically extremely unlikely.

@Pakk I have change my program

GolfScript, 41 bytes
0{2+.n\.[{6rand.+5-}*]{+}*!!*.}{}while;;;

Try it online!

JavaScript (ES2015), 75 78 bytes
f=(n=2)=>[...Array(n)].reduce(a=>a+Math.random()*6|0,n)==3.5*n?'':n+`
`+f(n+2)

Outputs a string of results separated by newlines
Edit: saved a byte thanks to Shaggy, added 4 bytes to start function at 2
Explanation
f=n=>
  [...Array(n)]                // Array of size n
    .reduce(                   // Combine each item
      a=>a+Math.random()*6|0,  // Add a random roll between 0 and 5 for each item
    n)                         // Start at n to correct rolls to between 1 and 6
    ==3.5*n                    // Compare total to most probable roll total
  ? ''                         // If true, end
  : n+'\n'+f(n+2)              // Otherwise, output n and continue

f=(n=2)=>[...Array(n)].reduce(a=>a+Math.random()*6|0,n)==3.5*n?'':n+`
`+f(n+2)

let roll = _ => document.getElementById('rolls').innerHTML = f();
document.getElementById('roll-button').onclick = roll;
roll();
<button id="roll-button">Roll</button>

Save a bytes by using a literal newline enclosed in backticks, instead of '\n'.

This does not start with n=2, instead you have to specify the starting number of dice when the function is called.

Mathematica, 47 bytes
For[n=1,Tr@RandomInteger[5,2n++]!=5n,Print[2n]]

-5 bytes from  LLlAMnYP

05AB1E, 17 bytes
[N·ÌD6Lã.R7;-O_#,

Try it online!
Explanation
[                   # loop over N in 0...
 N·Ì                # push N*2+2
    D               # duplicate
     6L             # push range [1 ... 6]
       ã            # cartesian product (combinations of N*2+2 elements in range)
        .R          # pick one at random
          7;-       # subtract 3.5 from each dice roll
             O_#    # if sum == 0 exit loop
                ,   # otherwise print the copy of N*2+2

C (gcc), 84 80 79 77 75 80 78 76 bytes
i;f(s,j){for(;s;s?printf("%d\n",i):0)for(j=i+=2,s=i*7/2;j--;)s-=1+rand()%6;}

Try it online!

Haskell  133 132 bytes
import System.Random;import Control.Monad
s k=do n<-replicateM k$randomRIO(1,6);if sum n==7*div k 2 then pure()else do print k;s(k+2)

Credit to @Laikoni for the suggestions in the comments below.

1.) Imports should be counted in the byte count. 2.) return() can be shortened to pure() and putStrLn$show can be shortened to print.

I will fix it right away. Thanks

Some further small things: div k 2 then can be div k 2then and do print k;s(k+2) is print k>>s(k+2).

Batch, 109 bytes
@set/an=%1+2,s=n*5/2
@for /l %%i in (1,1,%n%)do @call set/as-=%%random%%%%%%6
@if %s% neq 0 echo %n%&%0 %n%

Rather annoyingly, random is a magic environment variable, so it only gets replaced with a random value during environment expansion, which normally happens before the for loop starts. call makes it happen each time through the loop, but then you need to double the % signs to prevent the expansion from happening before the loop. The fun starts because we want to modulo the result by 6, which requires a real % sign, which now has to be doubled twice. The result is six consecutive %s.

php - 89 Characters
$r=0;$n=2;while($r!=$n*3.5){$r=$i=0;while($i<$n){$r+=rand(1,6);$i++;}print $n."
";$n+=2;}

you need not the first  $r=0; use echo instead of print $n." can be write as "$n and for loops instead of while allows do to something in the after loop or before to save some bytes

Octave 55 bytes
n=2;
while mean(randi(6,n,1))-3.5!=0
n
n=n+2;
end

Inspired by Andrewarchi's answer. If someone has any pointers to even shorten it, they are welcome.

Wow, TI-BASIC and Octave have surprisingly similar syntaxes

@andrewarchi Octave (the online version is what I use) is just the basics of the basics when it comes to programming.

Pyth, 20 bytes
K2WnsmhO6K*K3.5K=+K2

Try it online!

Welcome to PPCG!

Thanks! Just finished the Pyth tutorial and figured I might give it a try, although this is probably still improvable. Any suggestions are appreciated.

Ruby, 52 bytes
s=x=2;(s=0;p x.times{s+=rand(6)-2.5};x+=2)while s!=0

Explanation
s=x=2;                                                # sum=2, x=2
      (                                  )while s!=0  # while sum != 0:
       s=0;                                           #  reset the sum
           p                                          #  print
             x.times{              };                 #  repeat x times:
                     s+=                              #   Add to sum:
                        rand(6)                       #    random int in 0..5
                               -2.5                   #    subtract average
                                                      #  (implicitly return x for printing)
                                     x+=2             #  Increment x by 2

Try it online!

@Pakk note the s=0 at the front of the loop and the use of x.times. This means the sum is reset every time and then x dice are rolled, which should be the correct distribution. I'll write up an explanation of my code.

You are correct, I was too fast with my conclusion.

Calc2 0.7, 119 118 111 bytes
using"runtime";for(n=2,d=0;d!=3.5*n;Console.WriteLine(n),n+=2)for(i=d=0;i++<n;)d+=Math.Int(Random().Next(1,7));

ungolfed:
using "runtime";
var d = 0;
var r = Random();
for(var n = 2; d != 3.5 * n; Console.WriteLine(n), n += 2)
{
    d = 0;
    for(var i = 0; i < n; i++)
        d += Math.Int(r.Next(1,7));
}

I could do without the Math.Int() but unfortunately in 0.7 the Random().Next() functions have a bug where they all return doubles instead of ints. It has been fixed but only after this question was posted.
I'm not gonna win anything, but hey, nice proof of concept.
Edit:

removed unnecessary space between using and "runtime" (-1 byte)

Edit2:

removed var r and create a new Random where it's needed (-4 byte)
changed i=0,d=0 to i=d=0 (-2 byte)
incremented i after check (-1 byte)

QBIC, 40 bytes
{[1,r|g=g+_r1,6|]~g=r*3.5|_X\g=0?r┘r=r+2

Thispretty much literally does what the challenge asks for; seems the shortest way to get the distribution right.
Explanation
{          DO infinitely
[1,r|      FOR a=1, a<=r (at start, r == 2), a++
g=g+       Add to g (0 at start)
  _r1,6|   a random number between 1 and 6 incl.
]          NEXT
~g=r*3.5   IF the result of all dice rolls equals the expected value
|_X        THEN quit
\g=0       ELSE, reset the dice total
?r┘        PRINT the number of dice used
r=r+2      and add 2 dice.
           END IF and LOOP are courtiously provided by QBIC at EOF.

Rexx (Regina), 78 bytes
x=2
do forever
  t=0
  do x
    t=t+random(6)
  end
  if(t=x*3.5)then
    exit
  say x
  x=x+2
end

Try it online!

JavaScript (ES6) - 69 Characters

r=n=>n?r(n-1)+(Math.random()*6|0)-2.5:0;f=(n=2)=>r(n)?n+`
`+f(n+2):""

console.log(f())

Explanation:
r=n=>                                     # Roll n dice
     n?                                   # If there is a dice left to roll
       r(n-1)                             #   Roll n-1 dice
             +(Math.random()*6|0)         #   Add a random number from 0 .. 5
                                 -2.5     #   Subtract 2.5 so sum of average is 0
                                     :0   # Else total is 0

and:
f=(n=2)=>                                 # Start with n = 2
         r(n)                             # Roll n dice
             ?n+"\n"+f(n+2)               # If non-zero then concatenate n, newline and
                                          #    result for n+2 dice
                           :""            # If zero (average) terminate.

Perl 6, 48 bytes
.say for 2,*+2...^{3.5*$_==sum (1..6).pick xx$_}

Javascript, 87 chars
for(n=2;eval('+'.repeat(n).replace(/./g,x=>x+(Math.random()*6|0)))!=2.5*n;n+=2)alert(n)

Test with console.log instead of alert:

for(n=2;eval('+'.repeat(n).replace(/./g,x=>x+(Math.random()*6|0)))!=2.5*n;n+=2)console.log(n)
console.log('Done')

lua, 102 bytes
function r(n,t) for d=1,n do t=t+math.random(1,6)end return t==n*3.5 or print(n)or r(n+2,0)end r(2,0)

Or the more readable version
function r(n,t) --recursive function does its magic, t is given to safe usage bytes(no local)
    for d=1,n do --roll n dice and count them up to the total (t)
         t =t+math.random(1,6)
    end
    return t==n*3.5 or --check if t==n*3.5. If it is then it ends
           print(n) or --t != n*3.5 thus print n. print returns nil
           r(n+2,0) --both the check and the return value from print are false thus r gets executed.
end
r(2,0) --start the process

A more cheaty version for 96 bytes
function r(n,t,m)t=t+m(1,6)+m(1,6)return t==n*3.5 or print(n)or r(n+2,t,m)end r(2,0,math.random)

This pretty much works the same as the first but reuses the rolls from earlier calls. Because of this I can remove the for loop.
Both are tested in lua 5.2


text:
What type are my suffixes?
Intro
So I've been wasting my time again researching suffix sorting algorithms, evaluating new ideas by hand and in code. But I always struggle to remember the type of my suffixes! Can you tell me which type my suffixes are?
Left-most what?
A lot of suffix sorting algorithms (SAIS, KA, my own daware) group suffixes into different types in order to sort them. There are two basic types: S-type and L-type suffixes. S-type suffixes are suffixes that are lexicographically less (Smaller) than the following suffix and L-type if it is lexicographically greater (Larger). A left-most S-type (LMS-type) is just that: A S-type suffix that is preceeded by a L-type suffix.
The special thing about these LMS-type suffixes is that once we sorted them we can sorted all the other suffixes in linear time ! Isn't that awesome?
The challenge
Given a string assume it is terminated by a special character that is less than any other character in that string (e.g. smaller than even the null byte). Output a type corrosponding char for each suffix.
You can freely choose which char to use for which type but I'd prefer L, S and * for L-, S- and LMS-type as long as they are all printable (0x20 - 0x7E).
Example
Given the string mmiissiissiippi output (when using L, S and *):
 LL*SLL*SLL*SLLL

For example the first L is due to the fact that mmiissiissiippi$ is lexicographically greater than miissiissiippi$ (the $ represents the added minimal character):
L - mmiissiissiippi$ > miissiissiippi$
L - miissiissiippi$  > iissiissiippi$
* - iissiissiippi$   < issiissiippi     and preceeded by L
S - issiissiippi$    < ssiissiippi$
L - ssiissiippi$     > siissiippi$
L - siissiippi$      > iissiippi$
* - iissiippi$       < issiippi$        and preceeded by L
S - issiippi$        < ssiippi$
L - ssiippi$         > siippi$
L - siippi$          > iippi$
* - iippi$           < ippi$            and preceeded by L
S - ippi$            < ppi$
L - ppi$             > pi$
L - pi$              > i$
L - i$               > $

Some more examples:
"hello world" -> "L*SSL*L*LLL"
"Hello World" -> "SSSSL*SSLLL"
"53Ab§%5qS"   -> "L*SSL*SLL"

Goal
I'm not here to annoy Peter Cordes (I'm so gonna do this on stackoverflow sometime); I'm just very lazy so this is of course code-golf ! The shortest answer in bytes wins.

Edit: The order of the chars is given by their byte value. That means compare should be like C's strcmp.
Edit2: Like stated in the comments output should be a single character for each input character. While I assumed that would be understood as "return a string" it seems at least 1 answer returns a list of single characters. In order to not invalidate the existing answers I will allow you to return a list of single characters (or integers which when printed result in only 1 char).

Tips for linear time:

It can be done in 2 parallel forward iterations or in a single backward iteration.
The state of each suffix depends only on the first 2 chars and the type of the second.
Scanning the input in reverse direction you can determine L or S like this: $t=$c<=>$d?:$t (PHP 7), where $c is the current char $d the previous and $t the previous type.
See my PHP answer. Tomorrow I will award the bounty.

This is my first question :) Sandbox got two upvotes and no comments so I think its ready to be posted. Feel free to make suggestions !

What characters can appear in the input?

@MartinEnder all chars your string supports e.g. even the null byte for c++ style strings. Think of it as binary data.

What does * mean?

@LeakyNun * means the corresponding suffix is of type left most s-type. A S-type suffix that is preceeded by a L-type suffix..

Can numbers appear in the input? Are they less than other characters? Can we use the ASCII number representation of characters to determine lexicographical order?

@Luke "all chars your string supports". Uhm of course I should specify the order: Use the byte value to compare strings. I will edit that in thanks !

Some more test cases might be good. Am I right in thinking the result will always end in an L? What should be the result for an empty string as input, or is the input guaranteed to be non-empty?

@JonathanAllan You are right that the last one has to be L type: the following suffix is by definition always smaller so its always larger. Empty input would have an empty output (because there's no suffix that needs a type) but feel free to ignore that case.

Also, may we output an array of some other type - for example 1 in place of L, -1 in place of S and 0 in place of *?

@JonathanAllan I'd like to line up the input string and the type string under each other so I can easily see the type of the char when looking at a given suffix. So please output only a single char for each input char.

I assume the output will always start with either L or S?

@Neil Correct! There is never a L-type suffix in front of the first so there can never be a LMS-type in the first place.

Haskell, 64 53 48 42 bytes
(0!)
k!(x:y)|x:y>y=1:2!y|2>1=k:0!y
_![]=[]

Try it online!
Ungolfed, with Char instead of Int:
suffixes :: String -> String
suffixes = go 'S'
 where
   go :: Char -> String -> String
   go _ "" = ""
   go lorstar s | s > tail s = 'L' : go '*' (tail s)
                | otherwise  = lorstar : go 'S' (tail s)

Anonymous functions are allowed, so the z= can be removed.

I just can't read Haskell. Would you mind giving me a brief explaination?

@Christoph : the go function takes two arguments. The first is the character that represents what should be used to describe the S situation. The second is a string. It goes through that string recursively, removing the first character at each step (that's what tail does). The trick is that the first argument is set to * when the previous result was a L, or S otherwise. That way, in the case where an * or an S should be used, that first argument can be used directly. Hope that makes sense.

That's quite a nice idea ! I'm hoping to see more clever ideas :)

@ØrjanJohansen how am I supposed to prepare the result in TIO?

@bartavelle I haven't found a good way to avoid the name= in the TIO code panel, so I just strip it from the post by hand, and other people seem to do the same. If only there was a way to drop the line break after the header...

There is a standard format for titles in answers, which automated leaderboards rely on, so it's not a good idea to end it with anything not matching " bytes". I really just meant removing the z= in the post (and count) altogether. It requires editing the post a bit after preparing it in TIO, but only in two places.

@ØrjanJohansen I changed it in the description, but kept the TIO unchanged.

Oh, nice trick with the CPP in TIO. (Did my quine inspire you?)

Just had a hindsight, updating all my answers right now! I will look at your quine though!

Jelly,  25 23 21 20  19 bytes
Ṛ;\UỤỤIṠµI2n×ịØDṚ;0

A full program that prints the list of characters, using:
L: 0
S: 8
*: 9

(As a link it returns a list where all items are characters except the last one, which is a zero.)
Try it online! or see the test suite (with conversion to LS*).
How?
Ṛ;\UỤỤIṠµI2n×ịØDṚ;0 - Link: list of characters, s  e.g. "cast"
Ṛ                   - reverse                           "tsac"
  \                 - cumulative reduce by:
 ;                  -   concatenation                   ["t","ts","tsa","tsac"]
   U                - upend (reverse each)              ["t","st","ast","cast"] (suffixes)
    Ụ               - sort indexes by value             [3,4,2,1] (lexicographical order)
     Ụ              - sort indexes by value             [4,3,1,2] (order of that)
      I             - incremental differences           [-1,-2,1] (change)
       Ṡ            - sign                              [-1,-1,1] (comparisons)
        µ           - monadic chain separation, call that x
         I          - incremental differences           [0,2] (only (-1,1) produce 2s)
          2         - literal 2                         2
           n        - not equal?                        [1,0] (indexes of * will be 0)
            ×       - multiply by x (vectorises)        [-1,0,1] (make indexes of *s 0)
              ØD    - decimal yield                     "0123456789"
             ị      - index into (1-indexed & modular)  ['8','9','0']
                Ṛ   - reverse                           ['0','9','8']
                 ;0 - concatenate a zero                ['0','9','8',0]
                    - implicit print                     0980
                    -                              i.e. "L*SL"

Would you mind adding a small explaination for me ?

I will do of course - I am thinking about possible golfs first...

17 bytes

@LeakyNun How did you work that out?! You are using a bug there I think + on strings seems to vectorise but the underlying results are not actually Jelly iterables but strings (!) (e.g. try +@/L€ or +@/L€€ or ...)

@JonathanAllan yes, + produces actual string. This is an undocumented feature, or what you call bug.

@LeakyNun You have dropped a character by using pairwise reduction.

@LeakyNun would you mind explaining your proposal?

@Christoph I don't know why he hasn't accepted my proposal.

@LeakyNun because it does not work - it does not have the last character.

Python 3, 92 87 74 69 65 bytes
s=input()
c=1
while s:d=s<s[1:];print(d+(c<d),end='');s=s[1:];c=d

Uses 0 for L, 1 for S, and 2 for *. Wrap the input string in quote characters; I believe this is allowed by convention.
Try it online!
Example use:
mmiissiissiippi
002100210021000

saved 5 bytes thanks to Leaky Nun, 4 bytes thanks to ovs

69 bytes

This can be shortened to 65 bytes with Python 3

JavaScript (ES6), 51 45 bytes
f=(c,d)=>c&&(d<(d=c<(c=c.slice(1))))+d+f(c,d)

Saved 6 bytes thanks to @Neil.
A recursive solution to the exercise.

f=(c,d)=>c&&(d<(d=c<(c=c.slice(1))))+d+f(c,d)

console.log(f('mmiissiissiippi')); //LL*SLL*SLL*SLLL   002100210021000
console.log(f('hello world'));     //L*SSL*L*LLL       02110202000
console.log(f('Hello World'));     //SSSSL*SSLLL       11110211000
console.log(f('53Ab§%5qS'));       //L*SSL*SLL         021102100

Save 6 bytes: f=(c,d)=>c&&(d<(d=c<(c=c.slice(1))))+d+f(c,d)

Thanks, @Neil, I knew there had to be an optimization in there somewhere.

JavaScript (ES6), 52 bytes

f=
s=>s.replace(/./g,_=>(c<(c=s<(s=s.slice(1))))+c,c=1)
<input oninput=o.textContent=f(this.value)><pre id=o>

Port of @L3viathan's answer.

@RickHitchcock Oops, somehow I managed to port c=1 as c=0...

PHP, 70 bytes
L = 1, S = 0 , * = 2
Multibyte Support is needed for the last Testcase with the § +3 Bytes mb_substr instead substr

for(;$s=&$argn;$s=$u)$r.=$l=($l&1)+(1&$l^($s>$u=substr($s,1)));echo$r;

Try it online!
PHP, 71 bytes
L = 1, S = 0 , * = 2

for(;$s=&$argn;$s=$u)$r.=+($s>$u=substr($s,1));echo strtr($r,[10=>12]);

Try it online!
PHP, 74 bytes
for(;$s=&$argn;$s=$u)$r.=SL[$s>$u=substr($s,1)];echo strtr($r,[LS=>"L*"]);

Try it online!

$s=&$argn quite clever ! I'm pretty sure there is a better answer though ;) Hopefully someone comes up with it :)

@Christoph I have the feeling that I am miss something. I have try to store the last LS* in a varibale but it is longer

@Christoph mean you like so? I coul not really seen why the last testcase is false Try it online!

@Christoph Okay I have seen it why it not works for the last testcase I must use mb_substr instead of substr if the input is not in the simple ascii range. Is it necessary to support the last testcase?

I consider single byte values the default string type in PHP. That means you don't need to support multibyte chars.

@Christoph Thank You In this case I ignore the last testcase with the §

@Christoph mean you for example for(;~$c=$argn[-++$i];$l=$c)$r=($c<=>$l?$c>$l?1:0:$r[0]).$r;echo str_replace("10","12",$r); this with a backward iteration?

I was sure  strtr wouldn't go unnoticed :D

@Christoph I have not thinking about this. It helps not really cause I have found a shorter way without it. And I have compare measuring microtime my shortest way with yours. So I do not understand what you mean with two parallel forward iterations

My linear time version does a single pass over the input from the back to the front. But it can be done a bit more complicated by basically two interleaved for loops but its a bit hard to explain without code and I don't have the code for it anymore because it was a bit slower than the single backward iteration.

Haskell, 77 75 bytes, linear time
f(a:b:c)|let g"L"|a<b="SL";g"S"|a>b="L*";g d=d++d;d:e=f$b:c=g[d]++e
f _="L"

Try it online!
How it works
This uses recursion, stripping off one character at a time from the beginning of the string.  (The Haskell string type is a singly-linked list of characters, so each of these steps is constant-time.)

For a string abc where a and b are single characters and c is any (possibly empty) string,

f(abc) = SLe, if f(bc) = Le and a < b;
f(abc) = L*e, if f(bc) = Se and a > b;
f(abc) = LLe, if f(bc) = Le and a ≥ b;
f(abc) = SSe, if f(bc) = Se and a ≤ b.

For a single-character string a, f(a) = L.

Could you please provide an explanation?

Please provide a description so I can validate that this runs in linear time.

@Christoph Added.

@AndersKaseorg thanks for adding ! Sadly this seems quite verbose compared to the other Haskell answer. Could this be golfed further by not using S, L and *?

@Christoph The other Haskell answer is quadratic, and also returns output as a list like [1,1,2,0,1,1,2,0,1,1,2,0,1,1,1], which seems to violate your requirement to “output only a single char for each input char”.

Seems I wrongly assumed it outputs a string. Thanks for notifying me ! In order to not invalidate the top rated answer I will allow to return a list of single chars. Does this improve your answer ?

@Christoph To be clear, [1,1,2,0,1,1,2,0,1,1,2,0,1,1,1] is a list of single-digit numbers, not a list of single chars. In my case, I think outputting a list of numbers would not save me any bytes.

Sadly (for me) no competition on the linear time version :( Anyway congratulation on winning the bounty !

C (clang), 88 bytes
S(S,A,I)char*S,*A;{for(;strlen(S);A=S,S++,printf("%c",I=strcmp(A,S)>0?76:I==76?42:83));}

Try it online!

80 bytes

PHP, 82 byte, linear time
for($a=$argn;a&$c=$a[$i-=1];$d=$c)$a[$i]=2+$t=$d<=>$c?:$t;echo strtr($a,[13=>12]);

Walks over the input from right to left and replaces each char with the type.
$t=$d<=>$c?:$t

Calculates the type given the current and the previous char (-1 or 1). If equal the type doesn't change.

+1 for the idea with strtr

Python 2, 65 55 bytes
Recursive version, based on L3viathan's answer, using 012 as LS*:
def g(s,d=2):c=s<s[1:];return s and`c+(d<c)`+g(s[1:],c)

Try it online!
Python 3, 65 59 bytes
Recursive solution using L, S, and *:
f=lambda s:s and('LS'[s<s[1:]]+f(s[1:])).replace('LS','L*')

Runs through the string from the front, and replaces all instances of LSwith L*
Try it online!

blah if s else'' → s and blah saves six bytes. In Python 2, str(blah) → \blah`` saves another three bytes on the second solution.