63
\$\begingroup\$

Introduction

The Nineteenth Byte is CGCC's official chatroom (go check it out!). Its name is a play on the nineteenth hole, and it also refers to golf, which is appropriate for CGCC's chatroom's name. The name is also precisely \$19\$ bytes long, as its name states.

Challenge

Your task is to write a program that outputs Stack Exchange Chat - The Nineteenth Byte exactly. However, if the nineteenth byte and only the nineteenth byte of your source code is removed, it should output only Stack Exchange Chat. Because of this, the best score you can get will be \$19\$ bytes. For example, if your code is abcdefghijklmnopqrstuvwxyz, then abcdefghijklmnopqrstuvwxyz must output Stack Exchange Chat - The Nineteenth Byte and abcdefghijklmnopqrtuvwxyz must output Stack Exchange Chat.

Rules

  • Standard loopholes are forbidden.
  • Trailing whitespace is allowed.
  • If possible, please link to an online interpreter (e.g. TIO) to run your program on.
  • Please explain your answer. This is not necessary, but it makes it easier for others to understand.
  • Languages newer than the question are allowed. This means you could create your own language where it would be trivial to do this, but don't expect any upvotes.
  • You are scored by the length of the program that outputs Stack Exchange Chat - The Nineteenth Byte.
  • This is , so shortest code in bytes wins!
\$\endgroup\$
13
  • 2
    \$\begingroup\$ Brownie points for beating my 40 byte 05AB1E anwer. \$\endgroup\$
    – Makonede
    Mar 23, 2021 at 16:26
  • 1
    \$\begingroup\$ Is this the fastest upvoted challenge in history? 6 upvotes in 17min \$\endgroup\$
    – user100690
    Mar 23, 2021 at 16:44
  • 1
    \$\begingroup\$ I wish I could learn writing good challenges, for members here \$\endgroup\$
    – Wasif
    Mar 23, 2021 at 16:45
  • 1
    \$\begingroup\$ @ophact Maybe. :P also, got my 05AB1E solution down to 38 \$\endgroup\$
    – Makonede
    Mar 23, 2021 at 16:45
  • 2
    \$\begingroup\$ I will give a 100 rep bounty to the first person to find a (non-trivial) 19 byte solution in any language. \$\endgroup\$
    – Makonede
    Mar 25, 2021 at 22:19

56 Answers 56

24
+500
\$\begingroup\$

Jelly, 25 bytes

“¡TƑ9ı2ṆR“¡⁸¢6ṅȯ*ỵ#K»iƇ”h

Try it online! or Try it without #

Jelly, 25 bytes

“¡TƑ9ı2ṆR“¡TḟKY=ɱø~»tƑƇ⁶K

Try it online! or Try it without ~

How they work

“¡TƑ9ı2ṆR“¡⁸¢6ṅȯ*ỵ#K»iƇ”h - Main link. No arguments
“¡TƑ9ı2ṆR“¡⁸¢6ṅȯ*ỵ#K»     - Pair of compressed strings ["Stack Exchange Chat", " - The Nineteenth Byte"]
                      Ƈ   - Keep those for which the following is True:
                     i ”h - They contain "h"; ["Stack Exchange Chat", " - The Nineteenth Byte"]
                            Smash together and output

“¡TƑ9ı2ṆR“¡⁸¢6ṅȯ*ỵK»iƇ”h  - Main link. No arguments
“¡TƑ9ı2ṆR“¡⁸¢6ṅȯ*ỵK»      - Pair of compressed strings ["Stack Exchange Chat", "^Backets reamyappenzell"]
                     Ƈ    - Keep those for which the following is True:
                    i ”h  - They contain "h"; ["Stack Exchange Chat"]
                            Smash together and output

And the second one:

“¡TƑ9ı2ṆR“¡TḟKY=ɱø~»tƑƇ⁶K - Main link. No arguments
“¡TƑ9ı2ṆR“¡TḟKY=ɱø~»      - Pair of compressed strings ["Stack Exchange Chat", "- The Nineteenth Byte"]
                     ƑƇ   - Keep those where the following has no effect:
                    t  ⁶  -   Removing spaces from the front and end; ["Stack Exchange Chat", "- The Nineteenth Byte"]
                        K - Join with spaces; "Stack Exchange Chat - The Nineteenth Byte"

“¡TƑ9ı2ṆR“¡TḟKY=ɱø»tƑƇ⁶K  - Main link. No arguments
“¡TƑ9ı2ṆR“¡TḟKY=ɱø»       - Pair of compressed strings ["Stack Exchange Chat", " Backets reamyappenzell"]
                    ƑƇ    - Keep those where the following has no effect:
                   t  ⁶   -   Removing spaces from the front and end; ["Stack Exchange Chat"]
                       K  - Join with spaces; "Stack Exchange Chat"
\$\endgroup\$
5
  • 14
    \$\begingroup\$ Welp, time to go change my name to Backets reamyappenzell \$\endgroup\$
    – pxeger
    Mar 23, 2021 at 17:37
  • \$\begingroup\$ @pxeger inspired by his "many users of ppcg answer \$\endgroup\$
    – user100690
    Mar 23, 2021 at 18:02
  • \$\begingroup\$ How does # turn ^Backets reamyappenzell into ` - The Nineteenth Byte`? \$\endgroup\$
    – Jonah
    Mar 23, 2021 at 18:17
  • 2
    \$\begingroup\$ @Jonah The # is part of a compressed string (delimited with “...». Compressed strings work by treating their contents as a base-250 number, with each digit being a character in Jelly's code page, then repeatedly breaking up that number to generating words and characters. Adding or removing the # changes this base-250 number (same way that 12345 and 1245 are different numbers in base 10), and so would decompress to a different string \$\endgroup\$ Mar 23, 2021 at 18:23
  • 6
    \$\begingroup\$ @pxeger Careful, I learnt the hard way that name changes stick with you for far longer than you thought... \$\endgroup\$ Mar 23, 2021 at 20:38
14
\$\begingroup\$

Jelly, 25 24 bytes

“ÆçƲBnƥẈṛⱮ_ỴȷOṘỵḊĊ»»ḣ19$

Try it online!

Without the nineteenth byte

“ÆçƲBnƥẈṛⱮ_ỴȷOṘỵḊĊ»ḣ19$

Try it online!

It works no matter if you index from 0 or 1!

Explanation

“ÆçƲBnƥẈṛⱮ_ỴȷOṘỵḊĊ»»ḣ19$   Main niladic link
“ÆçƲBnƥẈṛⱮ_ỴȷOṘỵḊĊ»        "Stack Exchange Chat - The Nineteenth Byte"
                   »       [Calculate the byte-wise maximum with]*
                       $   (
                    ḣ19      Get the first 19 characters
                       $   )

*When indexing from 1, it's actually the first » that is removed, but the result is the same.

\$\endgroup\$
2
  • \$\begingroup\$ explanation please? \$\endgroup\$
    – Makonede
    Mar 23, 2021 at 16:57
  • 1
    \$\begingroup\$ @Makonede Added \$\endgroup\$
    – xigoi
    Mar 23, 2021 at 17:10
14
\$\begingroup\$

JavaScript (V8), 66 bytes

The nineteenth byte is the X.

print("Stack",(s="X"&&" - The Nineteenth Byte","Exchange Chat"+s))

Try it online!

Try it online! (nineteenth byte removed)

Commented

print(                            // print:
  "Stack",                        //   the first word followed by an implicit space
  (                               //
    s = "X" &&                    //   define s as either " - The Nineteenth Byte"
        " - The Nineteenth Byte", //   or an empty string if the 'X' is removed
    "Exchange Chat" + s           //   append "Exchange Chat" followed by s
  )                               //
)                                 // end
\$\endgroup\$
4
  • 1
    \$\begingroup\$ this was my original strategy (no mistakes) but then I decided to golf it more (failed) +1 \$\endgroup\$
    – user100690
    Mar 23, 2021 at 17:25
  • 1
    \$\begingroup\$ @Wasif apparent error that went unnoticed when I was creating my solution \$\endgroup\$
    – user100690
    Mar 23, 2021 at 17:26
  • 2
    \$\begingroup\$ @ophact Oh, I see. Variables that are defined only on some code paths are sometimes misleading. :-/ \$\endgroup\$
    – Arnauld
    Mar 23, 2021 at 17:31
  • 3
    \$\begingroup\$ yeah, got +3 votes for some reason. At least I got the Disciplined badge... \$\endgroup\$
    – user100690
    Mar 23, 2021 at 17:32
12
\$\begingroup\$

Python 2, 66 bytes

s,y='Stack Exch',01
print s+'ange Chat'+' - The Nineteenth Byte'*y

Try it online!

Not really a smart answer. :p

The nineteenth byte here is the 1.

y is 0 or 1 depending on if the nineteenth byte is removed.

thanks to pxeger for -2 bytes

\$\endgroup\$
4
  • 2
    \$\begingroup\$ 66 (idea stolen from @ophact's JS answer): Try it online! \$\endgroup\$
    – pxeger
    Mar 23, 2021 at 17:05
  • 1
    \$\begingroup\$ @pxeger good catch but sadly Neil pointed out a mistake in my answer which forced me to delete it. The octal number was probably the only takeaway from the answer \$\endgroup\$
    – user100690
    Mar 23, 2021 at 17:20
  • 1
    \$\begingroup\$ @pxeger cool. Actually I had tried the same trick in Python 3, but y=01 gives syntax error there. Not sure why the behaviour is like that. \$\endgroup\$ Mar 23, 2021 at 17:20
  • 3
    \$\begingroup\$ @ManishKundu 01 is octal, but that's not obvious to look at unless you're familiar with C already, so it was removed in favour of an 0o prefix in Python 3 \$\endgroup\$
    – pxeger
    Mar 23, 2021 at 17:22
12
\$\begingroup\$

Zsh, 54 bytes

set Exchange Chat \
- The Nineteenth Byte
<<<Stack\ $@

Try it online!

set assigns the given words to the default variable $@. As with the previous one, \ joins the two lines into one call to set, instead of treating - The Nineteenth Byte as a command (which does nothing).


Zsh, 55 bytes

1=" Exchange Chat"\
" - The Nineteenth Byte"
<<<Stack$1

Try it online!

Idea boringly copied from @xnor's genius answer. The \ escapes the newline, which concatenates the two strings; without it, the second line is ignored as an undefined command.


Zsh, 58 bytes

1=Stack\ Exchang
2=" - The Nineteenth Byte"
<<<$1e\ Chat$2

Try it online!

The 19th byte is the second =, which changes that line from a variable assignment to an undefined command which does nothing. Then, when printing, $2 defaults to empty.

\$\endgroup\$
0
11
\$\begingroup\$

Emotion, 34 bytes

😇😘🧖🚵🧖💫😋🧖💙🤙💁🤹☝🍓🧖💖🍸😚🤕😔😘😉💚🙌🙎🥥🤤👨🤑💇👱💔😯😨

The nineteenth byte is 🤕.

Try it online!

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Is this language made for golfing? Also, is there a tutorial I can learn from? \$\endgroup\$
    – Razetime
    Mar 24, 2021 at 16:41
  • 3
    \$\begingroup\$ @Razetime It's a language I made for golfing a couple of years ago, except it's not very efficient. Currently, I am rewriting the entire language with a different type system and may make a tutorial on the new version. \$\endgroup\$
    – Quantum64
    Mar 25, 2021 at 9:02
11
\$\begingroup\$

C (gcc), 69 bytes

Without the removal of the 19th byte, the full string (which is much less than 119 characters) is printed; if the 19th byte is removed, only 19 characters are printed instead.

main(){printf("%.119s","Stack Exchange Chat - The Nineteenth Byte");}

Try it online!

With the 19th byte removed: Try it online!

\$\endgroup\$
9
\$\begingroup\$

Python 2, 58 bytes

s="Exchange Chat "\
"- The Nineteenth Byte"
print"Stack",s

Try it online! (no 19th byte)

The 19th byte is the \ at the end of the first line. It acts as a line continuation character to make the full line be "Exchange Chat ""- The Nineteenth Byte" using Python's automatic concatenation of adjacent string literals.

Without the \, the line ends there, and the second line is lonely string value that doesn't do anything. The truncated string ends in a space, which is fine because the challenge allows for trailing whitespace.


Python 2, 61 bytes

s="Exchange Chat"+--1*" - The Nineteenth Byte"
print"Stack",s

Try it online! (no 19th byte)

The 19th byte is a -. Originally we append --1 (so, 1) copies of the string " - The Nineteenth Byte", with the 19th byte is removed, this is -1 copies which is nothing.

\$\endgroup\$
8
\$\begingroup\$

Husk, 25 23 bytes

ΣüL½¨ḟKȦΞ×ėCȧt-ξḟ%Nhβ/y

Try it online!

Try it online without the 19th byte!

Explanation

¨ḟKȦΞ×ėCȧt-ξḟ%Nhβ/y is a compressed string, equivalent to "Stack Exchange Chat - The Nineteenth Byte". If we remove N (the nineteenth byte of the program) we get ¨ḟKȦΞ×ėCȧt-ξḟ%hβ/y, which is equivalent to "Stack Exchange Chat - Thefischer\n Byte" (\n being a newline character).

Now, starting from one of these two strings:

  "Stack Exchange Chat - The Nineteenth Byte"    "Stack Exchange Chat - Thefischer\n Byte"

½   Split the string in half
  ["Stack Exchange Chat -",                      ["Stack Exchange Chat",
   " The Nineteenth Byte"]                        " - Thefischer\n Byte"]

üL   nub by length: remove strings with the same length as previous ones
  ["Stack Exchange Chat -",                      ["Stack Exchange Chat"]
   " The Nineteenth Byte"]

Σ   Join the strings together
  "Stack Exchange Chat - The Nineteenth Byte"    "Stack Exchange Chat" 
\$\endgroup\$
8
\$\begingroup\$

Scala 3, 90 bytes

val x="Stack Ex"+a/*/ */+" - The Nineteenth Byte"
def a="change Chat"
@main def m=print(x)

Try it in Scastie!

With the nineteenth byte removed:

val x="Stack Ex"+a// */+" - The Nineteenth Byte"
def a="change Chat"
@main def m=print(x)

Try it in Scastie!

The syntax highlighting should show what happens. This would be a byte shorter in a language without nested comments, since the space in /*/ */ wouldn't be needed, but I just like Scala :P

A possible solution with a newline that doesn't work because of parsing rules:

val x="Stack E"+a//
+" - The Nineteenth Byte"
def a="xchange Chat"
@main def m=print(x)
\$\endgroup\$
3
  • 2
    \$\begingroup\$ first answer to make use of comments, +1 \$\endgroup\$
    – user100690
    Mar 23, 2021 at 16:50
  • \$\begingroup\$ Hi, until what reputation you'll award the bounties on good old question answers? \$\endgroup\$
    – Wasif
    Mar 24, 2021 at 13:15
  • \$\begingroup\$ @Wasif I'll award them as long as I don't go below 5000 when I award one, so feel free to answer some old questions! (btw if you have any more questions, could you please ask in chat or on comments to the actual post?) \$\endgroup\$
    – user
    Mar 24, 2021 at 13:34
8
\$\begingroup\$

Scratch 3.0, 10 blocks/160 bytes

define
set[outpuuut v]to[Stack Exchange Chat - The Nineteenth Byte
set[outpuuu v]to[Stack Exchange Chat
if<(outpuuut)>(0)>then
say(outpuuut
else
say(outpuuu
end

This outputs Stack Exchange Chat - The Nineteenth Byte

Because Scratch is a block-based language, it may not seem obvious on how to remove a byte at first. But thankfully, there exists a text format called ScratchBlocks which we seem to allow for scoring. The above ScratchBlocks corresponds to the following real blocks:

This actually wasn't as painful as I thought it'd be

Try it on Scratch!

Removing the 19th byte of this program gives

define
set[outpuuu v]to[Stack Exchange Chat - The Nineteenth Byte
set[outpuuu v]to[Stack Exchange Chat
if<(outpuuut)>(0)>then
say(outpuuut
else
say(outpuuu
end

This outputs Stack Exchange Chat

enter image description here

Try it on Scratch!

Explanation coming soon

\$\endgroup\$
2
  • 2
    \$\begingroup\$ Could the variable names be shortened by lengthening the function name? \$\endgroup\$
    – user100690
    Mar 24, 2021 at 19:17
  • 1
    \$\begingroup\$ @ophact They can actually! This saves 23 bytes. \$\endgroup\$
    – Makonede
    Mar 25, 2021 at 16:51
8
\$\begingroup\$

Python 3.8 (pre-release), 72 bytes

print('Stack Exch{1}'.format(x:='ange Chat',x+' - The Nineteenth Byte'))

Try it online!

Different approach than @ManishKundu solution

Nineteenth byte is 1 removing it will result 0 to only suffix hange Chat

Thanks to @ZaelinGoodman for insight

-6 bytes to @Makonede

\$\endgroup\$
4
  • 2
    \$\begingroup\$ -5 with the walrus operator :=. \$\endgroup\$
    – Makonede
    Mar 23, 2021 at 17:47
  • 1
    \$\begingroup\$ -1 more (for a total of -6) making use of implicit str.format arguments: 'a{}b{}c'.format('1','2') -> 'a1b2c' \$\endgroup\$
    – Makonede
    Mar 23, 2021 at 17:51
  • \$\begingroup\$ Also, it's better to be consistent with quotes. EDIT: corrected a capitalization error in your code. \$\endgroup\$
    – Makonede
    Mar 23, 2021 at 18:32
  • 1
    \$\begingroup\$ Please fix the capitalization error in your code as well. And it's recommended (but not necessary) to stick to a single type of quotation marks the whole program. \$\endgroup\$
    – Makonede
    Mar 24, 2021 at 16:39
7
\$\begingroup\$

Python 2, 65 bytes

b='Stack Excha'
n=88
print b+'nge Chat - The Nineteenth Byte'[:n]

Try all of it
Try it without the 19th byte

Works in Python 3 trivially for 66 bytes

\$\endgroup\$
7
\$\begingroup\$

><>, 62 bytes

"Stack Exch"\" - "<
" tahC egna"/r>o<r/
eeteniN ehT"\"etyB htn

Try it online!

Try it without the Nineteenth byte

I've been playing around with ><> this week and this one was kind of a freebie, although it still turned out to be an interesting packing problem that ended up getting quite lucky at the end.

The Nineteenth byte is unsurprisingly the < at the end of the first row. With or without it, we'll execute "Stack Exchange Chat ", pushing that string onto the stack (in reverse order; usually we want to push strings backwards but here it's convenient to start with the prefix so we'll just reverse the stack later instead).

At this point, the program encounters the / at the end of the second row, hitting it from the right and heading down, conveniently going through the space between "Nineteenth" and "Byte", then wrapping around vertically and either heading leftwards on the first or second row. With the <, we execute "The Nineteenth Byte", pushing that string on the stack and then head to the output gadget, and without it we head directly to the output.

The output is done by first reversing the stack with r, and then heading into the bottomless pit of >o< which executes the output instruction o endlessly until the stack is emptied and the program exits via error.

\$\endgroup\$
7
+200
\$\begingroup\$

Factor, 95 94 87 bytes

Saved 1 precious byte thanks to @OriginalOriginalOriginalVI! Saved 7 more bytes thanks to @Bubbler!

"Stack Exchange C"f " - The Nineteenth Byte""hat"rot [ prepend nip ] [ glue ] if* print

Try it online!

Explained:

"Stack Exchange C"f " - The Nineteenth Byte""hat"  ! push items on the stack,
                                                   ! f (false) value is 19th char
rot                                                ! rotate, f now at top of stack
                                                   ! if f is missing, "Stack Exchange C"
                                                   ! is at the top
[ prepend nip ] [ glue] if* print                  ! if* f is found, glue the strings and print.
                                                   ! if* a string is found, it is considered to
                                                   ! be true, retain it on the stack, swap & glue
                                                   ! the top strings, drop the "19th Byte" string,
                                                   ! append and print.

Old version:

"Stack Exchange C"f "hat"" - The Nineteenth Byte"rot [ nip swap append ] [ 3append ] if* print

Try it online!

Explained:

"Stack Exchange C"f "hat"" - The Nineteenth Byte"  ! push items on the stack,
                                                   ! f (false) value is 19th char
rot                                                ! rotate, f now at top of stack
                                                   ! if f is missing, "Stack Exchange C"
                                                   ! is at the top
[ nip swap append ] [ 3append ] if* print          ! if* f is found, append the strings and print.
                                                   ! if* a string is found, it is considered to
                                                   ! be true, retain it on the stack, drop the
                                                   ! "19th Byte" string, swap stack strings,
                                                   ! append and print.
\$\endgroup\$
6
  • 1
    \$\begingroup\$ @Makonede No, it doesn't. Looks like those are all standard. \$\endgroup\$
    – user
    Mar 23, 2021 at 21:36
  • 2
    \$\begingroup\$ By the way, you can remove the space before rot. \$\endgroup\$
    – user
    Mar 23, 2021 at 21:38
  • 1
    \$\begingroup\$ @OriginalOriginalOriginalVI oops I missed it! thanks! \$\endgroup\$
    – hdrz
    Mar 23, 2021 at 21:39
  • 2
    \$\begingroup\$ glue is a shorter word to join three strings. Though it has different argument order, it doesn't matter much here. Also, prepend is shorter than swap append. 87 bytes. \$\endgroup\$
    – Bubbler
    Mar 24, 2021 at 0:39
  • 1
    \$\begingroup\$ @Bubbler I missed those two words in the manual somehow.. Thanks for that. \$\endgroup\$
    – hdrz
    Mar 24, 2021 at 7:06
6
\$\begingroup\$

PowerShell 7, 60 bytes

'Stack Exchange'+(!0 ?' Chat - The Nineteenth Byte':' Chat')
#                 ^
#                 19th byte

No TIO because the ternary operator is not supported in powershell 6 and below

Alternate Solutions

PowerShell 7, 60 bytes

"Stack Exchan$($x=!0 ?' - The Nineteenth Byte':'')ge Chat$x"
#                 ^
#                 19th byte

PowerShell, 61 58 bytes

-3 bytes thanks to @mazzy!!

"Stack Exchange {01}"-f'Chat','Chat - The Nineteenth Byte'
#                 ^
#                 19th byte

Try it online!

\$\endgroup\$
3
  • \$\begingroup\$ 58 bytes? \$\endgroup\$
    – mazzy
    Mar 24, 2021 at 3:58
  • 1
    \$\begingroup\$ @mazzy I had a feeling you'd come along and find a smarter way to do one of my secondary solutions lol. Thanks! \$\endgroup\$ Mar 24, 2021 at 11:55
  • \$\begingroup\$ fair competition of alternatives :) \$\endgroup\$
    – mazzy
    Mar 24, 2021 at 12:01
5
\$\begingroup\$

SNOBOL4 (CSNOBOL4), 90 bytes

              Y =1
	X =GT(Y) ' - The Nineteenth Byte'
	OUTPUT ='Stack Exchange Chat' X
END

Try it online!

The nineteenth byte here is the 1. SNOBOL treats an empty string as 0, and an empty right-hand assignment as an empty string. So when the byte is removed, the program assigns a value of 0 to Y, and the comparison Y GT (implicit 0) fails, hence X is assigned an empty value as well.

\$\endgroup\$
5
\$\begingroup\$

05AB1E, 27 bytes

” -€€¥ŠteenthÄÁ” õs”‚‹ºŠÆÿ

Try it online! and Try it without s

” -€€¥ŠteenthÄÁ” # Compressed string " - The Nineteenth Byte"
 õ               # push the empty string
 (s)             # (swap back to the other string)
   ”‚‹ºŠÆÿ      # push compressed string "Stack Exchange Chatÿ"
                 # where ÿ is replaced by the string on the top of the stack
\$\endgroup\$
1
  • 1
    \$\begingroup\$ s can also be ‎\‎ or Š. \$\endgroup\$
    – Makonede
    Mar 23, 2021 at 21:53
5
\$\begingroup\$

Java, 104 83 72 bytes

$->"Stack ExchangeA Chat".replaceAll("A(.*)","$1 - The Nineteenth Byte")

The nineteenth byte is A.

Saved 21 bytes thanks to 79037662.

Saved 11 bytes thanks to Olivier Grégoire.

Try it online!

Try it online (without the nineteenth byte)!

\$\endgroup\$
5
  • 2
    \$\begingroup\$ Replace ==18 with <19, and ("Ec","Exc") with ("E","Ex") to easily save a few bytes. \$\endgroup\$
    – 79037662
    Mar 23, 2021 at 19:19
  • 2
    \$\begingroup\$ Save some bytes by not using length and replace, which are long function names. Here the first 1 is the 19th byte: tio.run/##PY5Pa8MwDMXv/… \$\endgroup\$
    – 79037662
    Mar 23, 2021 at 19:25
  • 1
    \$\begingroup\$ @79037662 Great idea! Thanks. \$\endgroup\$ Mar 23, 2021 at 20:22
  • 2
    \$\begingroup\$ 72 bytes \$\endgroup\$ Mar 24, 2021 at 10:07
  • 1
    \$\begingroup\$ @OlivierGrégoire Good one. \$\endgroup\$ Mar 24, 2021 at 13:00
4
\$\begingroup\$

shortC, 54 bytes

Ds"Exchange Chat\x20- The Nineteenth Byte"
AJ"Stack "s

Try it online!

Without the Nineteenth byte

Ds"Exchange Chat\x0- The Nineteenth Byte"
AJ"Stack "s

Try it online!

\x20 denotes a space character, removing the 2 we get \x0 (null character) which in C is the string terminator.

\$\endgroup\$
4
\$\begingroup\$

R, 72 68 63 bytes

-4 bytes thanks to Dominic van Essen.

cat(scan(,"",3+0004))
Stack Exchange Chat - The Nineteenth Byte

Try it online!

The 19th byte is the 4. In the unaltered version, scan will read 7 words from the next line, and then print them. If you remove the 4, scan will read only 3 words and then print them.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ 68 bytes... \$\endgroup\$ Mar 25, 2021 at 12:29
  • 1
    \$\begingroup\$ @DominicvanEssen Nice, thanks! I had tried if(10)y=... but that led to an error when y is not defined; setting to NULL with your solution is elegant. \$\endgroup\$ Mar 25, 2021 at 12:35
  • 1
    \$\begingroup\$ This is also 68 bytes, and seems really wasteful with all the whitespace, but I don't know if it can be golfed any more... \$\endgroup\$ Mar 25, 2021 at 12:46
4
\$\begingroup\$

Excel, 73 70 bytes

Updated thanks to @EngineeringToast

=LET(a,"Stack ",b,1,a&"Exchange Chat"&IF(b," - The Nineteenth Byte",))

Original

=LET(s,"Sta",n,30--11,LEFT(s&"ck Exchange Chat - The Nineteenth Byte",n))

Shows all characters as is; the left 19 characters if the 19th byte (-) is deleted.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ 71 bytes: =LET(a,"Stack ",b,10,a&"Exchange Chat"&IF(b," - The Nineteenth Byte",)) where the 19th bytes is the 1 inside b,10. \$\endgroup\$ Mar 25, 2021 at 17:20
  • 1
    \$\begingroup\$ Thanks @EngineerToast. We can get it down to 70 eliminating the 0. \$\endgroup\$
    – Axuary
    Mar 25, 2021 at 17:45
4
\$\begingroup\$

Foo, 46 bytes

"Stack Exchange Ch"at"at - The Nineteenth Byte

Try it online!

Try it online!

Output the quoted strings, which don't have to be closed. Other commands don't matter.

\$\endgroup\$
4
\$\begingroup\$

Haskell, 63 bytes

main=putStr$take 119"Stack Exchange Chat - The Nineteenth Byte"

Try it online!

The 19th byte is the center 1 in 119.

\$\endgroup\$
3
\$\begingroup\$

Wolfram Language (Mathematica), 60 bytes

"Stack Exc"~Print~##&["hange Chat"," - The Nineteenth Byte"]

Try it online!

The 19th byte is one of the #s. ## represents a sequence of all arguments, but # represents only the first argument.

\$\endgroup\$
3
\$\begingroup\$

APL (Dyalog Classic), 61 bytes

¯12⌽∊('ge Chat'{⍺ ⍵}' - The Nineteenth Byte'),'Stack Exchan'

¯12⌽∊  ⍝ Rotate right 12
{⍺ ⍵}  ⍝ Concatenate
,      ⍝ Concatenate

Try it online!

\$\endgroup\$
8
  • 1
    \$\begingroup\$ Welcome to Code Golf! I think you left a newline at the end, but you can also do this for 53 bytes. \$\endgroup\$
    – user
    Mar 23, 2021 at 18:53
  • 1
    \$\begingroup\$ @Makonede Right, but I thought it would be appropriate to welcome them to CGCC, since they're a new contributor. \$\endgroup\$
    – user
    Mar 23, 2021 at 19:42
  • 1
    \$\begingroup\$ @OriginalOriginalOriginalVI Dang it, I knew there should be a way to use left tack. The selfie seems so obvious now, good call. \$\endgroup\$ Mar 23, 2021 at 19:48
  • 2
    \$\begingroup\$ @OriginalOriginalOriginalVI I am new, but I've answered one other :) codegolf.stackexchange.com/a/220985/92642 \$\endgroup\$ Mar 23, 2021 at 19:50
  • 2
    \$\begingroup\$ @OriginalOriginalOriginalVI Thanks! I'm glad I discovered code golf, it makes learning a new language less tedious :) \$\endgroup\$ Mar 23, 2021 at 19:59
3
\$\begingroup\$

Retina 0.8.2, 51 bytes


Stack Exchange Chat - The Nineteenth Byte
ht.*
hat

Try it online! Explanation: Tries to insert the whole string, but if the 19th byte (the a) is deleted, then replaces everything after the C with hat.

\$\endgroup\$
3
\$\begingroup\$

Pxem, filename: 2 bytes + content: 64 bytes = 66 bytes.

Thank you for commenting me that I need to use content of the file.

Filename

.e

Content

Stack Exchange Cha.p.c.c.zt - The Nineteenth Byte.p.d.a.v.st.v.p

How it works

  • Every command substring consists of a dot and a char.
  • Every non-command substring is considered to be a command to push each of the string from backwards.
    • I.e. literals.
  • Filename is main routine; content is subroutine.
  • .e calls subroutine.
  • 19th byte on content is . of .p --- a command to pop each to putchar().
    • Then the stack would be empty.
  • .c is dup() iff not empty; nop() otherwise.
  • .z ... .a is while size<2 || pop!=pop; do ... ;done.
  • .d is exit() on filename; return on content.
  • .v reverses entire stack.

Links to TIO

\$\endgroup\$
5
  • 2
    \$\begingroup\$ Sorry, but this is invalid as the code does not contain anything. The rules specifically state "the nineteenth byte of your source code," not "the nineteenth byte of your filename." \$\endgroup\$
    – Makonede
    Mar 24, 2021 at 16:40
  • 1
    \$\begingroup\$ So, isn't filename a source code, although filename is main routine for Pxem? \$\endgroup\$
    – user100411
    Mar 25, 2021 at 1:11
  • 1
    \$\begingroup\$ Even though programs are stored in the filename, that doesn't make the filename the source code. Also, please delete your answer instead of marking it as disqualified. \$\endgroup\$
    – Makonede
    Mar 25, 2021 at 1:32
  • 1
    \$\begingroup\$ How about this? \$\endgroup\$
    – user100411
    Mar 25, 2021 at 1:49
  • \$\begingroup\$ Yep, that works! \$\endgroup\$
    – Makonede
    Mar 25, 2021 at 1:51
3
\$\begingroup\$

Python 2, 65 bytes

a="Exchange Chat"
"#";a+=" - The Nineteenth Byte"
print"Stack",a

The nineteenth byte is the quotation mark before the hashtag. Removing it turns line 2 into a comment.

Works in Python 3 for 67 bytes, by adding brackets for the print() function.

\$\endgroup\$
4
  • 2
    \$\begingroup\$ Welcome to code golf! Nice idea and competitive as well! \$\endgroup\$
    – movatica
    Mar 24, 2021 at 16:27
  • \$\begingroup\$ Good first answer indeed! You can save a byte by removing the space between print and "Stack": Try it online! \$\endgroup\$
    – Makonede
    Mar 25, 2021 at 1:34
  • 1
    \$\begingroup\$ @Makonede Thanks for your help. I have updated the answer. \$\endgroup\$
    – user101772
    Mar 25, 2021 at 6:25
  • \$\begingroup\$ "Hashtag" ..... \$\endgroup\$
    – user100690
    Apr 11, 2021 at 11:36
3
\$\begingroup\$

Rust, 63 bytes

||print!("Stac{:.105}","k Exchange Chat - The Nineteenth Byte")

The nineteenth byte is the 0 in the formatting parameter.

Removing it changes the format string in the closure to print 15 characters from the argument instead of up to 105.

With the 19th byte: Try it online!
Without the 19th byte: Try it online!

Thanks to @ErikF for his inspiring C solution

\$\endgroup\$
1
  • \$\begingroup\$ Welcome to Code Golf, and nice first answer! \$\endgroup\$
    – Makonede
    Mar 25, 2021 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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