30
\$\begingroup\$

The goal of this challenge is to print the following tongue twister:

She sells seashells by the seashore,
The shells she sells are seashells, I'm sure.
So if she sells seashells on the seashore,
Then I'm sure she sells seashore shells.

This is more complicated than just calling your language's print equivalent. Since there are a lot of repeated words and phrases, you can greatly decrease the size of your code by using other tactics.

Rules:

  • No querying another website which will respond with the full twister
  • You must include all the punctuation and line breaks in the original text.
  • You can end with a trailing newline

This is , so the shortest code wins!

Good luck!

\$\endgroup\$
  • 7
    \$\begingroup\$ While there's a long history of natural-language text compression challenges coming down to a few built-in compression tools and tactics, I'm cautiously optimistic that this text's varied repetition and length will lead to some interesting solutions in at least some languages. \$\endgroup\$ – xnor Jul 1 at 10:44
  • 4
    \$\begingroup\$ Probably just a pet-peeve of mine, but it always annoys me when a sentence ends in a comma, and the sentence on the next line is capitalized regardless. (Although that might also be related to not being able to use a sentence-capitalize builtin, haha. ;p) \$\endgroup\$ – Kevin Cruijssen Jul 1 at 12:25
  • 1
    \$\begingroup\$ It would be easier if the first line used on instead of by. \$\endgroup\$ – user92069 Jul 1 at 12:51
  • \$\begingroup\$ What I made to find optimal solution(s) \$\endgroup\$ – branboyer Jul 9 at 1:37
  • 1
    \$\begingroup\$ 142 bytes is far from being the shortest answer. That would be "my pronoun is monicareinstate"s Bubblegum answer with 78 bytes. Shortest non-eso answer is my 126 bytes PHP as far as I can see. \$\endgroup\$ – Titus Jul 15 at 16:19

24 Answers 24

12
\$\begingroup\$

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

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

print("S by sh she s are seash,.\nSo if s onn sore sh.".translate(["he sells seash","ells"," the seashore,\nThe"," I'm sure"]*2))

Try it online!

Based on Netråm's C# answer.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ 152 bytes with translate and without the d replacement. (There are some unprintables in the string) \$\endgroup\$ – ovs Jul 1 at 16:57
  • \$\begingroup\$ @ovs Nice one - thanks! :-) \$\endgroup\$ – Noodle9 Jul 1 at 17:00
  • \$\begingroup\$ 147 bytes by using more unprintables and modifying the first replacement. \$\endgroup\$ – ovs Jul 1 at 17:11
  • 2
    \$\begingroup\$ @ovs Wow! Nice two - thanks! :D \$\endgroup\$ – Noodle9 Jul 1 at 17:22
  • \$\begingroup\$ Is there a reason you can't add " I'm sure" to the dictionary? \$\endgroup\$ – user253751 Jul 2 at 17:28
11
\$\begingroup\$

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

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ Your first line isn't quite right. Here is a 111-byter I came up with, but you might be able to fix this at no cost. \$\endgroup\$ – ovs Jul 1 at 11:51
  • \$\begingroup\$ @ovs Ugh, I wonder how far back I accidentally introduced that while golfing... \$\endgroup\$ – Neil Jul 1 at 12:28
  • \$\begingroup\$ @ovs well, 106 bytes seems reasonable now. would be 100 bytes if the first line used "on" instead of "by" (see Wikipedia). Try it online! \$\endgroup\$ – Neil Jul 1 at 12:40
  • \$\begingroup\$ 104 bytes with the patterns I used in my answer (except the last one which would result in +1 byte in Retina). \$\endgroup\$ – Arnauld Jul 2 at 3:09
  • 1
    \$\begingroup\$ @Arnauld Nice, but you missed a trick, you still have two of space+s. \$\endgroup\$ – Neil Jul 2 at 9:46
9
\$\begingroup\$

///, 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!

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ 126 bytes by using ' s' (notice space) as a substitute. \$\endgroup\$ – nph Jul 1 at 12:04
  • 1
    \$\begingroup\$ I've bugfixed my answer; does that help you at all? \$\endgroup\$ – Neil Jul 1 at 12:41
  • \$\begingroup\$ I was... maybe @nph was just confirming that it should help you? \$\endgroup\$ – Neil Jul 1 at 14:41
  • \$\begingroup\$ @Neil I can't understand nph's behavior... it's bizzare. \$\endgroup\$ – user92069 Jul 1 at 14:55
  • \$\begingroup\$ @Neil I misunderstood. I thought you were talking to me because I just commented. \$\endgroup\$ – nph Jul 1 at 18:43
9
\$\begingroup\$

JavaScript (ES6),  142  141 bytes

Saved 1 byte thanks to @Neil

_=>`246 / I'm5ure/he56/ the4ore,
The/5eash/ s/ells`.split`/`.reduce((s,p,i)=>s.split(i).join(p),`S0by35h652 are46,1.
So if50on3n1524ore5h6.`)

Try it online!

Compression steps

"ells" -> "6" (9 occurences, saved: 22 bytes)
She s6 seash6 by the seashore,
The sh6 she s6 are seash6, I'm sure.
So if she s6 seash6 on the seashore,
Then I'm sure she s6 seashore sh6.

" s" -> "5" (17 occurences, saved: 14 bytes)
She565eash6 by the5eashore,
The5h65he56 are5eash6, I'm5ure.
So if5he565eash6 on the5eashore,
Then I'm5ure5he565eashore5h6.

"5eash" -> "4" (6 occurences, saved: 18 bytes)
She5646 by the4ore,
The5h65he56 are46, I'm5ure.
So if5he5646 on the4ore,
Then I'm5ure5he564ore5h6.

" the4ore,\nThe" -> "3" (2 occurences, saved: 10 bytes)
She5646 by35h65he56 are46, I'm5ure.
So if5he5646 on3n I'm5ure5he564ore5h6.

"he56" -> "2" (4 occurences, saved: 7 bytes)
S246 by35h652 are46, I'm5ure.
So if5246 on3n I'm5ure524ore5h6.

" I'm5ure" -> "1" (2 occurences, saved: 5 bytes)
S246 by35h652 are46,1.
So if5246 on3n1524ore5h6.

"246 " -> "0" (2 occurences, saved: 1 byte)
S0by35h652 are46,1.
So if50on3n1524ore5h6.
| improve this answer | |
\$\endgroup\$
8
\$\begingroup\$

05AB1E, 91 86 bytes

“SheÌç1€‹€€0,
The¬•s‚ÎÌ瀙1,2.
So€¬‚ÎÌç1€‰€€0,
Then2‚ÎÌç0¬•s.“2Ý…½š¬•s#'í™ì“I'mˆ•“ª1ú:

Try it online.

Explanation:

“SheÌç1€‹€€0,
The¬•s‚ÎÌ瀙1,2.
So€¬‚ÎÌç1€‰€€0,
Then2‚ÎÌç0¬•s.“  # Push dictionary string "She sells1 by the0,
                 #                         The shells she sells are1,2.
                 #                         So if she sells1 on the0,
                 #                         Then2 she sells0 shells."
2Ý               # Push list [0,1,2]
…½š¬•s           # Push dictionary string "shore shells"
      #          # Split it on spaces: ["shore","shells"]
       'í™ì     '# Prepend dictionary string "sea" in front of both:
                 #  ["seashore","seashells"]
“I'mˆ•“ª        '# Append dictionary string "I'm sure" to this list:
                 #  ["seashore","seashells","I'm sure"]
1ú               # Pad each string with a leading space:
                 #  [" seashore"," seashells"," I'm sure"]
:                # Replace all [0,1,2] with [" seashore"," seashells"," I'm sure"]
                 # (after which the result is output implicitly)

See this 05AB1E tips of mine (section How to use the dictionary?) to understand how the dictionary strings work.

| improve this answer | |
\$\endgroup\$
6
\$\begingroup\$

Bubblegum, 79 78 bytes

removed trailing newline for -1 byte
The text in the tongue twister has many simple patterns. There are enough of them that even "normal" languages can save bytes. However, the only thing DEFLATE does is compressing simple patterns with little overhead...

00000000: 0bce 4855 284e cdc9 2906 9289 c519 6056  ..HU(N..).....`V
00000010: 52a5 4209 5018 2c90 5f94 aac3 1502 e441  R.B.P.,._......A
00000020: e58a e1ea 138b 5211 7a74 143c d573 158a  ......R.zt.<.s..
00000030: 4b8b 52f5 b882 f315 32d3 800a 310d cecf  K.R.....2...1...
00000040: c334 380f ae13 a105 a602 66ab 1e00       .48.......f...

Try it online!

After "writing" this answer, I finally decided to find a way to view the internal representation details of the string (to be specific, information on what characters are printed literally and what substrings are compressed as repetitions via LZ77). I modified kunzip (which already had some useful logging capabilities) to log only the information I want to see. This is the result:

output 83 S
output 104 h
output 101 e
output 32  
output 115 s
output 101 e
output 108 l
output 108 l
output 115 s
len: 3 dist: 6 ( se)
output 97 a
output 115 s
output 104 h
len: 5 dist: 10 (ells )
output 98 b
output 121 y
output 32  
output 116 t
len: 3 dist: 23 (he )
len: 5 dist: 17 (seash)
output 111 o
output 114 r
output 101 e
output 44 ,
output 10
output 84 T
len: 3 dist: 14 (he )
len: 7 dist: 28 (shells )
output 115 s
len: 9 dist: 48 (he sells )
output 97 a
output 114 r
output 101 e
len: 10 dist: 52 ( seashells)
output 44 ,
output 32  
output 73 I
output 39 '
output 109 m
output 32  
output 115 s
output 117 u
output 114 r
output 101 e
output 46 .
output 10
output 83 S
output 111 o
output 32  
output 105 i
output 102 f
len: 3 dist: 41 ( sh)
len: 18 dist: 89 (e sells seashells )
output 111 o
output 110 n
len: 18 dist: 89 ( the seashore,
The)
output 110 n
len: 9 dist: 58 ( I'm sure)
len: 10 dist: 51 ( she sells)
len: 8 dist: 34 ( seashor)
len: 8 dist: 118 (e shells)
output 46 .

I think might will be useful for "normal" language answers.

| improve this answer | |
\$\endgroup\$
5
\$\begingroup\$

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

string a=" she sells ",b="shells",c="seashore",d=a+"sea"+b;Write(@$"She{d[4..]} by the {c},
The {b}{a}are sea{b}, I'm sure.
So if{d} on the {c},
Then I'm sure{a}{c} {b}.")

Try it online!

The @ allows for line breaks inside string literals.

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ You can save 2 bytes by changing the She{d[4..]} to S{d[2..]}. \$\endgroup\$ – Kevin Cruijssen Jul 2 at 10:12
  • 1
    \$\begingroup\$ You can save 2 more bytes by changing {b}{a} to {b+a} and {a}{c} to {a+c} \$\endgroup\$ – Jirka Picek Jul 3 at 9:30
5
\$\begingroup\$

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

Write(@"S{0}sea{1} by the {2},
The {1} s{0}are sea{1}, I'm sure.
So if s{0}sea{1} on the {2},
Then I'm sure s{0}{2} {1}.","he sells ","shells","seashore")

Try it online!

| improve this answer | |
\$\endgroup\$
5
\$\begingroup\$

Japt, 108 105 104 96 93 92 bytes

`S230 by41h012 ‡e30,d.
So if1230 4˜123Že1h0.`dd` I'm1¨e`4` e3Že,
T”`3`1Á`2`”10`1" s"0`e¥s

Try it online!

Port of the retina answer to Japt.

Explanation

S230 by41h012 ‡e30,d.
So if1230 4˜123Že1h0.

Decompress into the string literal:

S230 by41h012 are30,d.
So if1230 on4nd123ore1h0.

Then we do replacements with:

d
 d` I'm1¨e`     // "d" with " I'm1ure"
 4` e3Že,\nT”`  // "4" with " the3ore,\nThe"
 3`1Á`          // "3" with "1eash"
 2`”10`         // "2" with "he10"
 1" s"          // "1" with " s"
 0`e¥s          // "0" with "ells"
| improve this answer | |
\$\endgroup\$
4
\$\begingroup\$

Stax, 83 bytes

ÇσGª☺Uë\╠╤↑╡V╦⌐∞┐ü9B@♦1ÖFò╫◄«vâ¬♂ƒQn→↨¥p▬♂♥å↓hb½Z╫Éà½♣µ\╩N>.▄┌bæ¼@3▲¡w8╣▐ù☼ve/h{≈ï░

Run and debug it

How?

Unpacked:

`...`'!/|J
`...`      - compressed string "She sells..." with '!' where newlines should be
     '!    - a '!' character
       /   - split the compressed string at '!' characters
        |J - join with newline characters

Maybe making a manual compression using the words will be shorter?

| improve this answer | |
\$\endgroup\$
4
\$\begingroup\$

ink, 129 130 bytes

-(i){|The shells|So if|Then I'm sure} {S|s}he sells {|are |}sea{|||shore }shells{& {on|by} the seashore,|{, I'm sure.|.->END}}
->i

Try it online!

  • +1 byte: A period was missing from the end of a line

Explanation

// Thanks to all the new whitespace, this ungolfed code doesn't quite work as is
-(i)                              // A label
{|The shells|So if|Then I'm sure} // A sequence - the first time we get here we print nothing,
                                  // the second time we print "The shells",
                                  // the third time we print "So if", etc
{S|s}                             // Sequences keep outputting their last value once it's been reached
he sells                          // Plain text just gets printed
{|are |}
sea{|||shore }shells
{& {on|by} the seashore,|{, I'm sure.|.->END}}
                                  // {& marks a repeating sequence.
                                  // Instead of getting stuck on its last value, this it starts over.
                                  // On the fourth pass we hit ->END and terminate the program
->i                               // On the other passes, we get here and go back to the start
| improve this answer | |
\$\endgroup\$
4
\$\begingroup\$

PHP, 133 126 bytes

<?=strtr("S2 s101 by t203,\nT2414e s1 are01,5.\nSo if4e s101 on t203,\nT2n54e s10341.",[" seash",ells,he,ore," sh"," I'm sure"]);

Try it online. Use PHP < 7.2 to avoid warnings

| improve this answer | |
\$\endgroup\$
3
\$\begingroup\$

Python, 179 176 bytes

print"She sells seashells by the seashore,\nThe shells she sells are seashells, I'm sure.\nSo if she sells seashells on the seashore,\nThen I'm sure she sells seashore shells."

Trivial algorithm, but nobody’s done it yet. I’m working on a better answer in a different language, but I don’t know if it should be posted in another answer or in this one. Shortening advice accepted, but I’m perfectly fine with just hard-coding it for now.

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ If you do come up with another answer, you should almost always post it separately. You should generally only include multiple answers in one post if they are extremely similar. Good luck! \$\endgroup\$ – FryAmTheEggman Jul 2 at 4:28
  • \$\begingroup\$ You have a space you can remove after print, and in Python 2 you can remove the () around the string \$\endgroup\$ – Stephen Jul 2 at 14:45
3
\$\begingroup\$

PowerShell, 158 bytes

Because if bash counts then why not...

$1="seash"
$5="ells"
$4="he s$5 "
$6=" I'm sure"
$2="$1$5"
$3="$1`ore"
"S$4$2 by the $3,`nThe $5 s$4`are $2,$6.`nSo if s$4$2 on the $3,`nThen$6 s$4$3 $5"

Try it online!

| improve this answer | |
\$\endgroup\$
3
\$\begingroup\$

Java 8, 169 160 bytes

v->"".format("S%sells by%s shells she sells are seashells, I'm sure.\nSo if s%1$sells on%2$sn I'm sure s%1$sore shells.","he sells seash"," the seashore,\nThe")

Port of @IgbyLargeman's C# answer, so make sure to upvote him as well!
-9 bytes thanks to @branboyer.

Try it online.

(Simply returning as is would be 174 bytes.)

Explanation:

v->           // Method with empty unused parameter and String return-type
  "".format(  //  Return the following formatted string:
     "S%sells by%s
      shells she sells are seashells, I'm sure.\n
     So if s%1$sells on%2$s
     n I'm sure s%1$sore shells.",
    "he sells seash",
              //   Where the first `%s` and all `%1$s` are replaced with "he sells seash"
    " the seashore,\nThe")
              //   and the second `%s` and all `%2$s` are replaced with " the seashore,\n
                                                                         The"
| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ 160 bytes (This can be ported to the C# code as well of course) I'm attempting to create code that'll find the best solution; that's the best I got right now. \$\endgroup\$ – branboyer Jul 8 at 2:33
  • 1
    \$\begingroup\$ @branboyer Nice golfs, thanks. \$\endgroup\$ – Kevin Cruijssen Jul 8 at 6:37
  • 1
    \$\begingroup\$ My github link to the finished project for optimizing this problem (could be used with other similar problems). \$\endgroup\$ – branboyer Jul 9 at 1:00
  • 1
    \$\begingroup\$ @branboyer Ah nice, I will keep this comment in mind if a similar KC challenge is posted. A brute-forcer to get the shortest substrings is a nice approach. Thanks. \$\endgroup\$ – Kevin Cruijssen Jul 9 at 7:19
3
\$\begingroup\$

PicoLisp, 160 157 146 142 138 bytes

(prin(text"S@1 @2 by the @3,
The @5 s@1 are @2,@4.
So if s@1 @2 on the @3,
Then@4 s@1 @3 @5.""he sells"'seashells'seashore" I'm sure"'shells]

Using the template:

S1 by the 2,
The 5 s1 are 2,4.
So if s1 on the 3,
Then4 s1 3 5.

Where 1 is "he sells", 2 is "seashells", 3 is "seashore", and 4 is " I'm sure"

Ideone It!

{ 14 imaginary interweb points for guessing which syntax highlighting I'm using without peeking }

Common Lisp, 160 bytes

(format t"S~a~a by the ~a,~%The shells s~3:*~Aare ~a, I'm sure.~%So if s~3:*~A~a on the ~a,~%Then I'm sure s~3:*~a~*~a shells.""he sells ""seashells""seashore")

https://ideone.com/n7zVUm

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

FEU, 112 111 bytes

-1 byte thanks to Neil

a/S256 by43h632 are56,1.\nSo if3256 on4n1325ore3h6.
m/1/ I'm3ure/2/he36/3/ s/4/ the5ore,\nThe/5/ seash/6/ells/g

Try it online!

Port of JavaScript answer.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ The 0/256 / replacement only makes sense in the JS answer because the 0 is implicit as the match; here it actually costs you a byte. \$\endgroup\$ – Neil Jul 2 at 23:47
2
\$\begingroup\$

V (vim), 110 bytes

iS230 by41h012 are30,5.
So if1230 on4n5123ore1h0.Í5/ I'm1ure
Í4/ the3ore,\rThe
Í3/1eash
Í2/he10
Í1/ s
Í0/ells

Try it online!

Port of @Neil's retina answer to V (vim)

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

Python 2, 175 158 bytes

thanks @branboyer for the edit!

print"S{0}ells by{1} shells she sells are seashells, I'm sure.\nSo if s{0}ells on{1}n I'm sure s{0}ore shells.".format("he sells seash"," the seashore,\nThe")

Try it online!

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

PowerShell, 134 133 132 bytes

-1 byte thanks @Titus

see similar by Nail and Arnauld

$d='S0by36h461 are54,2.
So if60on3n2615ore6h4.'
"154 #he64# I'm6ure# the5ore,
The#ells#6eash# s"-split'#'|%{$d=$d-replace$i++,$_}
$d

Try it online!

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ Lose one more byte by putting " s" last, so you can use it in " seash". Beat my php! \$\endgroup\$ – Titus Jul 6 at 23:31
  • \$\begingroup\$ Thanks! You made php great again. :) \$\endgroup\$ – mazzy Jul 9 at 8:28
  • 1
    \$\begingroup\$ Your code inspired me. Excellent shell scripting! I almost wish someone could "bash" me. :D \$\endgroup\$ – Titus Jul 10 at 17:49
1
\$\begingroup\$

Bash, 156 bytes

i=" I'm sure"
h=" she"
k=lls
l=" seashe"$k
s=" seashore"
e=" se"$k
printf "She$e$l by the$s,
The$h$k$h$e are$l,$i.
So if$h$e$l on the$s,
Then$i$h$e$s$h$k."

An expert can probably save some more here.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Consider using Try it online! - it counts your bytes and also creates MarkDown for you. \$\endgroup\$ – Neil Jul 2 at 23:58
  • \$\begingroup\$ 151 bytes \$\endgroup\$ – branboyer Jul 9 at 3:27
1
\$\begingroup\$

zlib, 84 bytes

Hex dump:

00000000: 78 9c 0b ce 48 55 28 4e cd c9 29 06 92 89 c5 19  x...HU(N..).....
00000010: 60 56 52 a5 42 09 58 18 28 90 5f 94 aa c3 15 02  `VR.B.X.(._.....
00000020: e2 41 e4 8a e1 ea 13 8b 52 11 7a 74 14 3c d5 73  .A......R.zt.<.s
00000030: 15 8a 4b 8b 52 f5 b8 82 f3 15 32 d3 90 14 22 0c  ..K.R.....2...".
00000040: ce cf c3 34 38 0f ae 13 5d 4b 7e 11 cc 56 3d 00  ...48...]K~..V=.
00000050: 3c 70 3a e6                                      <p:.

Raw hex:

789c0bce4855284ecdc929069289c519605652a54209581828905f94aac31502e241e48ae1ea138b52117a74143cd573158a4b8b52f5b882f31532d39014220ccecfc334380fae135d4b7e11cc563d003c703ae6

Or generate this file yourself:

openssl zlib < seashells.txt > seashells.zlib

You can decompress this file execute this program with:

openssl zlib -d < seashells.zlib

or, presumably, any of the answers here.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Assuming I remember what header is used by gzip and what header is used by zlib, If you remove the first two bytes, this becomes a Bubblegum answer. (note that I already posted a shorter one) \$\endgroup\$ – my pronoun is monicareinstate Jul 3 at 2:18
1
\$\begingroup\$

JavaScript (V8), 287 bytes

Trying a different way of compressing it, in a different language. Feedback is appreciated!

function s(){a="kdg by the dj,/nThe g care dg, I'm sure./nSo if cdg on the dj,/nThen I'm sure cdj g.".replace(/c|k/g,function(match){return(match=="c")?"she sells ":"She sells ";});c=a.replace(/d|g/g,function(match){return(match=="d")?"sea":"shells";});return (c.replace(/j/g,"shore"));}

Try it online!

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ Compressing attempts made it longer, annoyingly. I don't think it can be shorter, but I would appreciate help. \$\endgroup\$ – Bardic Wizard Jul 6 at 21:14
0
\$\begingroup\$

Scala, 155 bytes

printf("S%2$s by%1$s shells%3$sare seashells, I'm sure.\nSo if s%2$s on%1$sn I'm sure%3$sshells."," the seashore,\nThe","he sells seashells"," she sells ")

Try it online!

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.