62
\$\begingroup\$

The challenge is simple: Print the last, middle, and first character of your program's source code, in that order.

The middle character is defined as follows, assuming a source length of n characters, and 1-indexing:

  • If n is even, print the n/2-th and n/2 + 1-th character. (abcdef == cd)
  • If n is odd, print (n-1)/2 + 1-th character. (abcde == c)

Rules

  • Given no input, print the last, middle, and first character in your source code, in the form [last][middle][first]. This will be 3-4 characters long.
  • Output must not contain any trailing whitespace. However, if whitespace is a first, middle, or last character, it must be printed as such.
  • Source code must be n >= 3 characters long.
  • Code must consist of >= 3 unique characters.
  • Standard loopholes are forbidden.
  • This is , so shortest solution in characters wins.

Samples

# Form: [code] --> [output]
xyz --> zyx
abcd --> dbca
1 --> # not allowed: too short
abcde --> eca
aaabb --> # not allowed: not enough unique characters
System.out.print("S;pr"); --> ;prS
this is a test --> ts t
123[newline]45 --> 53[newline]1

Challenge Proposal

Leaderboards

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

# Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

# Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

# Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the leaderboard snippet:

# [><>](http://esolangs.org/wiki/Fish), 121 bytes

var QUESTION_ID=188005;
var OVERRIDE_USER=78850;
var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;function answersUrl(d){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+d+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(d,e){return"https://api.stackexchange.com/2.2/answers/"+e.join(";")+"/comments?page="+d+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(d){answers.push.apply(answers,d.items),answers_hash=[],answer_ids=[],d.items.forEach(function(e){e.comments=[];var f=+e.share_link.match(/\d+/);answer_ids.push(f),answers_hash[f]=e}),d.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(d){d.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),d.has_more?getComments():more_answers?getAnswers():process()}})}getAnswers();var SCORE_REG=function(){var d=String.raw`h\d`,e=String.raw`\-?\d+\.?\d*`,f=String.raw`[^\n<>]*`,g=String.raw`<s>${f}</s>|<strike>${f}</strike>|<del>${f}</del>`,h=String.raw`[^\n\d<>]*`,j=String.raw`<[^\n<>]+>`;return new RegExp(String.raw`<${d}>`+String.raw`\s*([^\n,]*[^\s,]),.*?`+String.raw`(${e})`+String.raw`(?=`+String.raw`${h}`+String.raw`(?:(?:${g}|${j})${h})*`+String.raw`</${d}>`+String.raw`)`)}(),OVERRIDE_REG=/^Override\s*header:\s*/i;function getAuthorName(d){return d.owner.display_name}function process(){var d=[];answers.forEach(function(n){var o=n.body;n.comments.forEach(function(q){OVERRIDE_REG.test(q.body)&&(o="<h1>"+q.body.replace(OVERRIDE_REG,"")+"</h1>")});var p=o.match(SCORE_REG);p&&d.push({user:getAuthorName(n),size:+p[2],language:p[1],link:n.share_link})}),d.sort(function(n,o){var p=n.size,q=o.size;return p-q});var e={},f=1,g=null,h=1;d.forEach(function(n){n.size!=g&&(h=f),g=n.size,++f;var o=jQuery("#answer-template").html();o=o.replace("{{PLACE}}",h+".").replace("{{NAME}}",n.user).replace("{{LANGUAGE}}",n.language).replace("{{SIZE}}",n.size).replace("{{LINK}}",n.link),o=jQuery(o),jQuery("#answers").append(o);var p=n.language;p=jQuery("<i>"+n.language+"</i>").text().toLowerCase(),e[p]=e[p]||{lang:n.language,user:n.user,size:n.size,link:n.link,uniq:p}});var j=[];for(var k in e)e.hasOwnProperty(k)&&j.push(e[k]);j.sort(function(n,o){return n.uniq>o.uniq?1:n.uniq<o.uniq?-1:0});for(var l=0;l<j.length;++l){var m=jQuery("#language-template").html(),k=j[l];m=m.replace("{{LANGUAGE}}",k.lang).replace("{{NAME}}",k.user).replace("{{SIZE}}",k.size).replace("{{LINK}}",k.link),m=jQuery(m),jQuery("#languages").append(m)}}
body{text-align:left!important}#answer-list{padding:10px;float:left}#language-list{padding:10px;float:left}table thead{font-weight:700}table td{padding:5px}
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Sites/codegolf/primary.css?v=f52df912b654"> <div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td><a href="{{LINK}}">{{SIZE}}</a></td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td><a href="{{LINK}}">{{SIZE}}</a></td></tr></tbody> </table> 

\$\endgroup\$
  • 6
    \$\begingroup\$ Maybe it's only me, but "Code must consist of >= 3 unique characters." suggests all characters of the program should be unique, while you only require to have at least 3 distinct characters. \$\endgroup\$ – Grzegorz Oledzki Jul 9 '19 at 19:22
  • 4
    \$\begingroup\$ @Belhenix Fewer than three unique characters allows solutions as simple as 121 for a great many languages. \$\endgroup\$ – Khuldraeseth na'Barya Jul 9 '19 at 19:32
  • 2
    \$\begingroup\$ If anyone can find a stack-based language that uses - for negation and implicitly prints with a linefeed, \n1- is a three-byter. My search has so far been fruitless. \$\endgroup\$ – Khuldraeseth na'Barya Jul 9 '19 at 19:35
  • 3
    \$\begingroup\$ @Belhenix Whitespace is certainly possible, it has enough unique valid characters (space, linefeed, tab). \$\endgroup\$ – bigyihsuan Jul 9 '19 at 19:46
  • 2
    \$\begingroup\$ Can't change it now with 58 answers, but requiring "first letter of code must be different from last letter of code" would have ruled out a lot of trivial answers, including the current top answer. That may have been the intent of ">= 3 unique characters", but that requirement isn't actually very hard. \$\endgroup\$ – manassehkatz-Moving 2 Codidact Jul 10 '19 at 14:10

100 Answers 100

3
\$\begingroup\$

Brain-Flak, 11 bytes

(((())))

Try it online!

Explanation

We need to put 3 things on the stack. The fastest way to do that is to put 3 1s (or zeros) on the stack. Now since  (code point 1) does nothing in Brain-Flak we can add these to the program at the first middle and last places. Now this feels a bit cheaty so here are two more answers that are less cheaty in my opinion.

Prints braces, 31 bytes

( (((((()()()()()){}){}){}))())

Try it online!

This answer prints braces so that the characters printed are actually relevant to the code, it does have one padding character to make the length odd so we only have to print 1 middle character.

Contains only braces, 32 bytes

(((()((((()(()()){}){}){}){}))))

Try it online!

This is a braces only program both the source and (consequently) the output are made up entirely of braces (character Brain-Flak actually cares about).

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

R, 11 bytes

cat("))c" )

Try it online!

Outputs ))c. Space added to make the number of characters odd: otherwise we would need to output 4 characters, and that would make the code longer anyway.

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ Is this allowed? tio.run/##K/r/3y/R7/9/AA If so, you can cut it down to 3 bytes... \$\endgroup\$ – Sumner18 Aug 20 '19 at 14:33
  • \$\begingroup\$ @Sumner18 I don't think it's allowed, because the initial [1] in the output counts. And maybe the trailing newline as well... \$\endgroup\$ – Robin Ryder Aug 21 '19 at 11:48
3
\$\begingroup\$

HQ9+ 4 characters

+AQ+

Explanation:

+ ; increment accumulator
A ; nop
Q ; print itself
+ ; increment accumulator
|improve this answer|||||
\$\endgroup\$
  • 1
    \$\begingroup\$ Code must consist of >= 3 distinct characters \$\endgroup\$ – Draco18s no longer trusts SE Jul 9 '19 at 18:32
  • \$\begingroup\$ @Draco18s thanks, I missed that part of the rule. I think I fixed it \$\endgroup\$ – Helena Jul 9 '19 at 18:54
3
\$\begingroup\$

Forth (gforth), 9 bytes

Prints an escape-supporting string.

.\"   ." 

Try it online


Also 9 bytes:

Prints three spaces.

 ."    " 

Try it online


9 bytes with Stack Underflow:

 ." .. ".

Try it online


The 2nd and 3rd solutions also work if you replace first quotations with ( and last quotes with ). Essentially, plenty of ways to do it in 9 bytes, but probably not any shorter.

Documentation

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

AsciiDots - 9 bytes

.---$'.$.

Output: .$.

The code starts with a ., ends with a ., and the middle character is a $. The single quote in the middle sets the dot print mode to simply read characters straight into the output stream.

It is possible that this could be made smaller, but I'm starting to doubt that it can. In order to print three characters, the single quote must be used, as the double quote would require an end to the string in order to output. However, this means that the single quote has to a) be followed by three characters and b) cannot be the center character. In order to crunch this down to seven bytes, I was considering trying to reuse the dot's start as one of the printed characters (sort of like AsciiDot's quine program). However, I found that the shortest sequence available for printing was ($' which would have had to print four characters in the space of three, or three characters in the space of four. I also tried some hacky alternative methods like trying to print the dot's value (which is 0) as one of the characters. While there may be some system that works, I've found these to be rather complex and large. Thus, I think that the above is the smallest solution. (I will update if I find something smaller)

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ Welcome to Code Golf SE! I messed around with this for a few minutes and came to the same conclusion you did. Nice first post! \$\endgroup\$ – Khuldraeseth na'Barya Jul 11 '19 at 18:23
  • 1
    \$\begingroup\$ Alternative 9 bytes - /'$'-.[newline]\.Try it online! \$\endgroup\$ – Alion Jul 13 '19 at 14:34
3
\$\begingroup\$

MATLAB, 1315 bytes

disp(  ') d')

Outputs ) d

Previous version (15 bytes, less strict output):

'''';1;''''''''

Outputs '''

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ I see now, now worries. \$\endgroup\$ – Ad Hoc Garf Hunter Jul 11 '19 at 0:40
  • \$\begingroup\$ Doesn't this output trailing whitespace? \$\endgroup\$ – Sanchises Jul 14 '19 at 12:13
  • \$\begingroup\$ @Sanchises nope, size(ans)==3 \$\endgroup\$ – aaaaa says reinstate Monica Jul 14 '19 at 16:03
  • \$\begingroup\$ Yes, but the actual output is ans =\n '''\n. Usually that's not a problem but this challenge seems to set a stricter standard. But then I may be interpreting the challenge wrong. \$\endgroup\$ – Sanchises Jul 14 '19 at 17:36
  • \$\begingroup\$ @Sanchises hm, i see. i might misunderstand what codegolf considers "output" then, your output seems to be literally the output, formatted by MATLAB \$\endgroup\$ – aaaaa says reinstate Monica Jul 14 '19 at 18:18
2
\$\begingroup\$

Charcoal, 7 bytes

←´←´´´X

Try it online! The final X could be any byte in the Charcoal code page except 0xFF and the two already in use. Works by printing the desired characters leftwards. Alternative approach, also 7 bytes:

←”y←←”y

Try it online! The final y could be any ASCII character but I picked y because of the symmetry. Works by printing two s leftwards so that the final character gets printed at the start of the output.

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

Forth (gforth), 13 bytes

: f ." ; :" ;

Try it online!

Code Explanation

: f         \ start a new word definition
  ." ; :" ; \ print "; :"
;           \ end the word definition
|improve this answer|||||
\$\endgroup\$
  • 1
    \$\begingroup\$ You should add a footer, so people can actually see the output: tio.run/##S8svKsnQTU8DUf//WymkKegpKVgrWAGJ/2n/AQ \$\endgroup\$ – mbomb007 Jul 9 '19 at 19:05
  • \$\begingroup\$ Fixed, Thanks for the heads up, I totally forgot to call the function \$\endgroup\$ – reffu Jul 10 '19 at 3:05
2
\$\begingroup\$

AppleScript, 4

1021

Outputs the last char (1), the middle chars (02), and the first char (1).

Any four-digit number with the same first and last digits and different middle digits works.

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ 2 Distinct characters are a requirement \$\endgroup\$ – Nick Kennedy Jul 9 '19 at 13:42
  • 1
    \$\begingroup\$ @LuisfelipeDejesusMunoz Does this edit qualify? \$\endgroup\$ – a stone arachnid Jul 10 '19 at 4:00
2
\$\begingroup\$

PowerShell, 7 bytes

Another trivial solution. The first and the last lines contains LF.


"`nn"

Try it online!


PowerShell, 9 bytes

non-trivial, no byte sequence hacks. The first line contains LF only. The second line starts with a space.


 echo hh

Try it online!

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

Japt, 5 bytes

Inspired by my JavaScript solution.

N'a*N

Try it

|improve this answer|||||
\$\endgroup\$
  • 1
    \$\begingroup\$ Ah-ha! I knew there had to be a 5 byter! Nice work. \$\endgroup\$ – Shaggy Jul 11 '19 at 21:04
2
\$\begingroup\$

Kotlin, 39 25 bytes

fun main(){print("}rf")
}

Try it online!

Edit: -14 bytes thanks to @daniero

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ main doesn't need parameters, you can drop 15 bytes \$\endgroup\$ – daniero Jul 10 '19 at 18:42
  • \$\begingroup\$ @daniero Cool, didn't realize that - thanks! (Only dropped 14 bytes and added an extra new line because if otherwise id have to print 4 characters) Also kinda cool that just by chance it still had the same output \$\endgroup\$ – Quinn Jul 10 '19 at 18:46
2
\$\begingroup\$

INTERCAL, 65 bytes

PLEASE,1<-#3DO,1SUB#1<-#246DON'TPARSE!!
DO READ OUT ,1
DO GIVE UP

Try it online!

Padding the second half of the program to make the output PPP seems to be shorter than printing multiple distinct characters.

PLEASE ,1 <- #3         Declare that the length of the uint16 array ,1 is 3.
DO ,1 SUB #1 <- #246    Make the first element of ,1 246. (The other elements are 0.)
DON'T PARSE!!           This statement is ignored and nonsense.
DO READ OUT ,1          Print ,1 using C-INTERCAL's "Turing Tape" I/O.
DO GIVE UP              End the program.

This one almost works for 35 bytes, but it prints a space before the first newline:


PLEASE       READ OUT#500DOGIVEUP

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

Stax, 5 bytes


.PPP

Run and debug it at staxlang.xyz!

The leading linefeed does nothing. .PP pushes the string PP, and the final P prints it with a trailing newline. The last character is P, the middle character is the first P, and the first character is a linefeed.

The implicit print's trailing linefeed invalidates the 4-byte solutions 1231 and .S.S (adapted from Weijun Zhou's quine).

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

Keg, 7 5 bytes

1\':'

This prints ''1, which are the respective characters.

No Try It Online available for Keg.

Here is an uninteresting 4-byte answer:

1231
|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ Good to see Keg standing up to 05AB1E in code golf! \$\endgroup\$ – Lyxal Jul 11 '19 at 23:44
  • \$\begingroup\$ would abca also work as an uninteresting answer? \$\endgroup\$ – Lyxal Jul 13 '19 at 5:18
  • \$\begingroup\$ Yes. I am trying to keep this simple, so I will not add this to the answer. \$\endgroup\$ – user85052 Jul 13 '19 at 5:21
2
\$\begingroup\$

C++ (clang) (lambda expression), 17 bytes

[]{return "}n[";}

Try it online!


C++ (clang) (full program), 47 43 bytes


#import<ios>
int main() {std::puts("}n");}

Try it online!

 

Unfortunately had to leave an extra space in both of the solutions, to make them have an odd number of characters.

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

Python 3 12 13 bytes

input(r')ri')
|improve this answer|||||
\$\endgroup\$
2
\$\begingroup\$

Bitwise Cyclic Tag But Way Worse, 26 bytes

ÿ1111111122ÿ2000000002ÿ

Outputs ÿ ÿ ÿ. 26 bytes since ÿ is considered 2 bytes in UTF-8.

Try it Online!

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

Cubix, 9 bytes


oN/
@oo

Try it online!

Reasonably boring one. Since the newlines in the first, middle and last positions are ignored by the interpreter the code wraps onto the following cube. Spaces could be used as well. eg oS/ @oo

  o
N / @ o
  o

Watch it run

  • N Pushs 10 (newline) onto the stack.
  • / redirects around the cube.
  • ooo outputs the newline 3 times.
  • /@ redirects again and halts the program
|improve this answer|||||
\$\endgroup\$
2
\$\begingroup\$

Haskell, 19 bytes


main=($LT)print--L

Try it online! Outputs LT<newline>.

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

Lost, 21 bytes

v<<<<<>>>>>
>%?"v>@"@

Outputs: v>@.

Try it online or verify that it's deterministic.

Explanation:

Explanation of the language in general:

Lost is a 2D path-walking language. Most 2D path-walking languages start at the top-left position and travel towards the right by default. Lost is unique however, in that both the start position AND starting direction it travels in is completely random. So making the program deterministic, meaning it will have the same output regardless of where it starts or travels, can be quite tricky.

A Lost program of 2 rows and 5 characters per row can have 40 possible program flows. It can start on any one of the 10 characters in the program, and it can start traveling up/north, down/south, left/west, or right/east.

In Lost you therefore want to lead everything to a starting position, so it'll follow the designed path you want it to. In addition, you'll usually have to clean the stack when it starts somewhere in the middle.

Explanation of the program:

All arrows, including the >v in the string, will lead the path towards the leading > on the second line. From there the program flow is as follows:

  • >: travel in an east/right direction
  • %: Put the safety 'off'. In a Lost program, an @ will terminate the program, but only when the safety is 'off'. When the program starts, the safety is always 'on' by default, otherwise a program flow starting at the exit character @ would immediately terminate without doing anything. The % will turn this safety 'off', so when we now encounter an @ the program will terminate (if the safety is still 'on', the @ will be a no-op instead).
  • ?: Clean the top value on the stack. In some program flows it's highly likely we have a partial string on the stack, so we use this to wipe the stack clean of that potential string.
  • ": Start a string, which means it will push the integer code-points of the characters used (rather similar as the Whitespace program).
  • v>@: Push the code-points for these characters, being 118 62 64 respectively
  • ": We're done pushing code-points of this string
  • @: Terminate the program if the safety is 'off' (which it is at this point). After which all the values on the stack will be output implicitly. Using the -A program argument flag these code-points will be output as characters instead.

Two things to note:

The top part could also have been v<<<<<<<< instead. Lost will wrap around to the other side when moving in a direction. So using v<<<<>>>> could be a slightly shorter path, and since it's the same byte-count anyway, why not use it. :)
Also, the first line contains an additional < and >. One of them is to avoid having the newline character as the middle of the program, which is rather difficult to output and would have only increased the byte-count. The second is to make the program length odd again, so we'd only have to output a single middle character instead of two.

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

6502, 17/21 bytes

6502: 17 bytes if running in zero page

For initial testing I used Py65, a 6502-based microcomputer simulator written in Python. Starting Py65 with the command-line parameter -o ff moves the character output port to zero page address $FF, shaving three bytes from the code.

The program must be loaded and run at $0000, to guarantee outputing the correct three characters (in order) from the program with values 00 B5 A5.

Here are the program bytes and their respective disassembly view in Py65:

.mem 0000:0010
0000:  a5  10  85  ff  a9  11  4a  aa  b5  00  85  ff  a5  00  85  ff  00

.d 0000:0010
$0000  a5 10     LDA $10
$0002  85 ff     STA $ff
$0004  a9 11     LDA #$11
$0006  4a        LSR A
$0007  aa        TAX
$0008  b5 00     LDA $00,X
$000a  85 ff     STA $ff
$000c  a5 00     LDA $00
$000e  85 ff     STA $ff
$0010  00        BRK

6502: 21 bytes if running outside zero page

Four additional bytes are required to allow the program to run outside of zero page. Three of the those bytes are the change in the LDA (load accumulator) instructions from zero page to absolute addressing. The fourth is the addition of a NOP (no operation) instruction, to maintain an odd number of bytes in the program.

This version of the program must be loaded and run at $0300, to guarantee outputing the correct three characters (in order) from the program with values 00 00 AD.

Here are the program bytes (character values) and their respective disassembly view:

.mem 0300:0314
0300:  ad  14  03  85  ff  a9  15  4a  aa  bd  00  03  85  ff  ad  00  03  85
0312:  ff  ea  00

.d 0300:0314
$0300  ad 14 03  LDA $0314
$0303  85 ff     STA $ff
$0305  a9 15     LDA #$15
$0307  4a        LSR A
$0308  aa        TAX
$0309  bd 00 03  LDA $0300,X
$030c  85 ff     STA $ff
$030e  ad 00 03  LDA $0300
$0311  85 ff     STA $ff
$0313  ea        NOP
$0314  00        BRK

6502: 21 bytes if running on an Apple II

We've come this far, so let's plop this baby on an Apple II. I don't normally tote around my Apple //c anymore, so I used a2ix on my Android phone.

Instead of sending characters to an addressed port, they will go to COUT (character output), a routine in system ROM.

$0300 is the usual spot for small assembly routines, so that's where I'll enter and list it. Running it yields a flashing space (60), inverse N (0E), and a normal " (A2). On the Apple II, ASCII characters are remapped across the 256-character range to achieve different character effects in text mode.

*300: A2 14 20 0E 03 A9 15 4A AA 20 0E 03 A2 00 BD 00 03 20 ED FD 60

*300L

0300-   A2 14       LDX   #$14
0302-   20 0E 03    JSR   $030E
0305-   A9 15       LDA   #$15
0307-   4A          LSR
0308-   AA          TAX
0309-   20 0E 03    JSR   $030E
030C-   A2 00       LDX   #$00
030E-   BD 00 03    LDA   $0300,X
0311-   20 ED FD    JSR   $FDED
0314-   60          RTS

Relocating this to a free area of zero page (good luck!) would not yield any byte savings. While the absolute indexed LDA (load accumulator) at $030E could be switched to its zero page indexed counterpart to save one byte, an NOP (no operation) would have to be added to avoid additional code to support print two middle characters.

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

05AB1E, 5 bytes

×'×3×

Try it online!

×   push a string of nothing, repeated nothing times (in other words, push an empty string)
'×  push "×"
3×  push "×", repeated 3 times
    implicitly print top of stack
|improve this answer|||||
\$\endgroup\$
2
\$\begingroup\$

GolfScript, 7 5 bytes


".".

Try it online!

Explanation

     # A newline, just to hide the effect of the automatic trailing newline
"."  # The . character: the last and middle character
   . # Copy the character twice

# Implicitly output the whole stack without a delimiter.

# This returns ".." (the . character duplicated) and a trailing newline.
|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ There is a trailing newline at the end of the output; I'm not sure that's allowed. There is a boring 5 byte answer which only outputs 2 spaces and a newline: TIO. \$\endgroup\$ – Robin Ryder Jul 21 '19 at 6:41
  • \$\begingroup\$ @RobinRyder No, it doesn't. It just outputs a single space and a newline. (TIO renders a newline as a space.) \$\endgroup\$ – user85052 Jan 9 at 10:48
2
\$\begingroup\$

AWK, 17 bytes

BEGIN{print"}iB"}

Try it online!

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

naz, 28 24 bytes

0a9a3a9m3a2o0a0a0a0a0m2o

Explanation

0a9a3a9m3a2o # Output "o" twice
0a0a0a0a     # Padding bytes
0m2o         # Output "0" twice

Original 28-byte solution: 0a9a3a9m3a1o0a0a0a9s5s1o0m2o

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

JavaScript (Babel Node), 11 bytes

_=>(')\)_')

Try it online!

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ My approach: alert(")\"a") - sadly 2 Bytes longer with 13 Bytes \$\endgroup\$ – pixma140 Jul 9 '19 at 14:26
  • \$\begingroup\$ 9 bytes using a similar trick you used in your PHP solution. \$\endgroup\$ – Oliver Jul 10 '19 at 19:33
1
\$\begingroup\$

Elm 0.19, 11 bytes

f()="\"\\f"

Prints "\f. See it working here.

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

APL (Dyalog Unicode), 9 bytes

⎕←'''''⎕'

Try it online!

Both the last and middle characters are ', while the first is .

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

SNOBOL4 (CSNOBOL4), 19 bytes


	OUTPUT = 'D='
END

Try it online!

Prints D=<newline>, using SNOBOL's trailing newline in OUTPUT.

D=

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