Print a tongue twister!

Retina 0.8.2, 106 103 bytes


S230 by41h012 are30,5.¶So if1230 on4n5123ore1h0.
5
 I'm1ure
4
 the3ore,¶The
3
1eash
2
he10
1
 s
0
ells

Try it online! Explanation: In Retina, a substitution only makes sense if it's long enough l for the number n of repetitions. The substitution saves n(l-1) bytes in the compressed text but costs l+3 bytes in the replacement stages. This gives the minimum length required to be useful as follows:

  • 2 repetitions: length > 5
  • 3 repetitions: length > 3
  • 4 repetitions: length > 3
  • 5 repetitions: length > 2
  • 6+ repetitions: length > 1

Edit: As @Arnauld pointed out, you can count repetitions from the substitution entries as well. This means that although there were only 5 repetitions of space+s in my previous encoded text, there are also 3 repetitions in the substitutions, thus allowing me to save 3 bytes overall. (@Arnauld himself had only spotted 2 of the 3 repetitions.)


Python 3, 166 \$\cdots\$ 142 135 bytes

Saved a whopping 13 18 bytes thanks to ovs!!!
Saved 4 bytes thanks to user253751!!!
Saved a byte thanks to branboyer!!!
Saved 7 bytes thanks to dingledooper!!!

Note: There's lots of unprintables in the following code so please avert your eyes if you're sensitive to such things! :D

print("Sh by are,.\nSo if onnore.".translate("| seash|ells|ore,\nThe| sh|e s| I'm sure| the".split("|")))

Try it online!

Based on Netråm's C# answer.


///, 115 bytes

Port of Neil's answer + accepting nph's suggestion.

/3/ I'm4ure//2/4eash//1/he40//0/ells//4/ s/S120 by the2ore,
The4h041 are20,3.
So if4120 on the2ore,
Then3412ore4h0.

Try it online!