20
\$\begingroup\$

Write a program to print or return one of these strings verbatim:

abcdefghijkmnopqrstuvwxyz

ABCDEFGHIJKMNOPQRSTUVWXYZ

Notice that there is no L.

\$\endgroup\$
5
  • 16
    \$\begingroup\$ Probably worth saying "Note that there's Noel in there!" to avoid any confusion. \$\endgroup\$ Nov 23, 2023 at 21:31
  • 1
    \$\begingroup\$ Does it have to be printed or can it be returned from a function? \$\endgroup\$
    – Yousername
    Nov 23, 2023 at 21:51
  • 2
    \$\begingroup\$ @Yousername returning it is fine. \$\endgroup\$
    – Someone
    Nov 23, 2023 at 21:51
  • 4
    \$\begingroup\$ Could be useful, or not: 65-75, 77-90 on oeis \$\endgroup\$
    – Stef
    Nov 24, 2023 at 14:08
  • 4
    \$\begingroup\$ Or, in song form by Alex Horne and the Horne Section. \$\endgroup\$
    – TRiG
    Nov 24, 2023 at 17:55

40 Answers 40

1
2
2
\$\begingroup\$

Kotlin, 40 35 bytes

{(('a'..'z')-'l').joinToString("")}

Try it online!

Kotlin, 40 35 31 bytes

{(('a'..'z')-'l').map(::print)}

Try it online!

Lambdas () -> String and () -> Unit, respectively, that uses minus applied to a CharRange.

-5 bytes thank to @corvus_192's wonderful reminder that minus can be replaced by -

-4 bytes on () -> Unit by replacing the forEach with a map.

\$\endgroup\$
2
  • \$\begingroup\$ why not {(('a'..'z')-'l').joinToString("")} \$\endgroup\$
    – corvus_192
    Nov 27, 2023 at 11:09
  • \$\begingroup\$ @corvus_192 I've completely forgot that minus can be overloaded as -. Thank you so much! \$\endgroup\$
    – enzo
    Nov 27, 2023 at 11:38
2
\$\begingroup\$

C (GCC), 48 46 42 bytes w/ help from @Neil and @ceilingcat

main(x){for(;x++<27;)x-13&&putchar(x+63);}

Attempt this online

\$\endgroup\$
4
  • \$\begingroup\$ x-27&&(x-12&&putchar(x+64))+main(x+1); seems to work. \$\endgroup\$
    – Neil
    Nov 25, 2023 at 5:56
  • \$\begingroup\$ Or perhaps x-26&&putchar(x+64+(x>11))+main(x+1);? \$\endgroup\$
    – Neil
    Nov 25, 2023 at 5:57
  • \$\begingroup\$ Yep, that makes better sense :P. Added. \$\endgroup\$
    – Qaziquza
    Nov 25, 2023 at 11:02
  • \$\begingroup\$ c;f(){for(c=64;++c<91;)c-76&&putchar(c);} is 41 bytes, but f(){puts("abcdefghijkmnopqrstuvwxyz");} is 39 \$\endgroup\$
    – veqtrus
    Dec 26, 2023 at 15:29
2
\$\begingroup\$

GolfScript, 10 bytes

91,65>'L'-

Try it online!

GolfScript, 11 bytes

'alm{'{,^}/

Try it online!

\$\endgroup\$
1
2
\$\begingroup\$

Python, 65 bytes:

Uses the formula given by Stef in the comments, so I guess this could probably stay up for not being boring...

lambda:''.join(chr(int(i+((1.5*i)**.5)//1))for i in range(56,81))
\$\endgroup\$
1
\$\begingroup\$

Commodore BASIC - 28 characters

Enter this in direct mode, the ? denotes a PRINT command:

?"ABCDEFGHIJKMNOPQRSTUVWXYZ

Note that in Commodore BASIC, you do not necessarily require a closing quotation mark when printing a string literal.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Isn't this 27 characters (or bytes)? \$\endgroup\$
    – Aiden Chow
    Nov 28, 2023 at 7:32
  • \$\begingroup\$ One PETSCII character on Commodore 8-bit machines is equal to 1 byte, but Commodore BASIC, like many early Microsoft BASIC variants is tokenised. \$\endgroup\$ Nov 29, 2023 at 8:56
  • \$\begingroup\$ A more precise answer is that it is difficult to make a byte count for my entry here as it is a special kind of program that runs in direct mode, i.e., it is run immediately after you enter this and press the RETURN key. It is not stored in BASIC memory, unlike BASIC programs which are written with line numbers, and may be executed with the RUN command. \$\endgroup\$ Nov 30, 2023 at 9:16
1
\$\begingroup\$

Pyth, 9 bytes

+<G11>G12

Try it online!

Explanation

G - Pyth's pre-initialised variable to the lowercase letters in the alphabet.

< - used to slice the string till 11.

> - used to slice the string from 12, thereby leaving the letter l.

Pyth, 4 bytes | Thanks to @FryAmTheEggman

-G"l

Try it online!

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Nice! You can save quite a bit by using -, which is overloaded in Pyth to work on strings in a manner similar to how it works on sets. \$\endgroup\$ Nov 27, 2023 at 17:04
1
\$\begingroup\$

Pip, 6 bytes

zRM"l"

Yea I think that's about as short as it can get, unless someone has some genius strategy.

Try It Online!

\$\endgroup\$
1
\$\begingroup\$

Knight (v2), 27 bytes

;=a 64W>91=a+1a|?76aO+Aa'\'

Try it online!

Well, at least it's shorter than this (28 bytes):

O"ABCDEFGHIJKMNOPQRSTUVWXYZ"
\$\endgroup\$
1
\$\begingroup\$

YASEPL, 26 bytes

algorithmic way of doing it

=a$97`1}3,108,2›`2+}2,123

YASEPL, 28 bytes

lazy way of doing it

>"abcdefghijkmnopqrstuvwxyz"
\$\endgroup\$
0
\$\begingroup\$

Deadfish~, 27 bytes

iisiiiis{ic}ici{ic}icicicic

Try it online!

My first Deadfish~ answer, I don't know if it could be improved.

How does it work?

ii                             accumulator: 2
  s                            accumulator: 4
   iiii                        accumulator: 8
       s                       accumulator: 64
        {ic}                   accumatator: [65, 75] ('A' -> 'J')
            ic                 accumulator: 76 ('K')
              i                accumulator: 77
               {ic}            accumulator: [78, 88] ('M' -> 'V')
                   icicicic    accumulator: [89, 92] ('X' -> 'Z')
\$\endgroup\$
1
2

Your Answer

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

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