37
\$\begingroup\$

The program must print the alphabet four times: first in the normal alphabetical order, second in the order of a qwerty keyboard, third in the order of a dvorak keyboard, and lastly in reverse alphabetical order. The output should resemble this:

abcdefghijklmnopqrstuvwxyz
qwertyuiopasdfghjklzxcvbnm
pyfgcrlaoeuidhtnsqjkxbmwvz
zyxwvutsrqponmlkjihgfedcba

The output is not case-sensitive, and you can add or omit newlines or spaces wherever you wish.

The catch: the program must be less than 104 characters, or, in other words, smaller than the length of the alphabet times four.

I will accept the answer with the shortest code, unless I see something really clever or interesting that I am more impressed with.

EDIT: I will accept the shortest answer on Wednesday, 4/27/2011.

EDIT2: And the winner is (as usual) Golfscript in 64 chars! Second place, which is behind by only three chars, is also in Golfscript, with 67 chars, followed by Bash in third place with 72 chars.

But there were a few others I wanted to mention, such as this one, which, depending on your definition, only used 52 "characters", and this one where he wrote it in a language he created.

There were a few people who broke an unwritten rule and did not qualify, but I will mention them just for their way of thinking without the box.

\$\endgroup\$
  • 11
    \$\begingroup\$ Consider using a bounty for an answer that impressed you. I think accepting an answer in a code-golf should always be the natural criterion (i.e. length). \$\endgroup\$ – Joey Apr 23 '11 at 16:00
  • \$\begingroup\$ I lost using Tcl: tio.run/… \$\endgroup\$ – sergiol Jul 25 '17 at 22:19

37 Answers 37

16
\$\begingroup\$

Python 2, 97 characters

q="qwertyuiopasdfghjklzxcvbnm"
a="".join(sorted(q))
print a,q,"pyfgcrlaoeuidhtnsqjkxbmwvz",a[::-1]

Sorting QWERTY and converting back from list to string is shorter than the alphabet itself!*

Another option for generating the alphabet in fewer characters than the alphabet itself:

print map(chr,range(65,91))

Although this prints a Python list of characters.

There's not much to be done here in the way of data compression; jamming the letters into 5 bits only saves 39 characters, which isn't a lot if you then have to un-jam them (and you still have to represent the bytes literally); it looks like zlib (just as an example) saves fewer than 20 bytes; encoding the sequence as a list of deltas to the next letter still takes 5 bits for each delta, because the largest in this sequence is -22:

[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
 1, 1, 1, 1, 1, 1, 1, -9, 6, -18, 13, 2, 5, -4, -12, 6, 
 1, -15, 18, -15, 2, 1, 2, 1, 14, -2, -21, 19, -20, 12, 
 -1, 3, 9, -19, 1, -4, 15, -6, -11, 14, -10, 16, -12, -5, 
 4, 12, -6, 5, -2, -7, 1, 13, -22, 11, 10, -1, 4, 0, -1, 
 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

* Although only slightly.

\$\endgroup\$
  • 1
    \$\begingroup\$ Python 3.5: q="qwertyuiopasdfghjklzxcvbnm";a=sorted(q);print(*a,q,"pyfgcrlaoeuidhtnsqjkxbmwvz",*a[::-1]) \$\endgroup\$ – Veedrac Mar 23 '16 at 8:22
15
\$\begingroup\$

PHP, 100 bytes

As ISO 8859-1:

<?=base64_encode("i·yø!9%z)ª»-ºü1Ë:°z»rº*)jÇ_ä<\½¹æ§'àr¹Z¡ë¢vg²¨äŹ°¿<òÇî¶Êê¦æHâÞuÆÚ");

To reproduce reliably,

printf '<?=base64_encode("' > 4times.php
printf abcdefghijklmnopqrstuvwxyzqwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvzzyxwvutsrqponmlkjihgfedcba | base64 -d >> 4times.php
printf '");' > 4times.php
\$\endgroup\$
  • 5
    \$\begingroup\$ That's an interesting way to do it. All of the other ones are variations on the same idea, but this one is a little different. \$\endgroup\$ – Peter Olson Apr 23 '11 at 20:05
  • \$\begingroup\$ I don't think this should count; the question is tagged "Kolmogorov complexity" and specifies "104 characters" which means we should be discriminating on what we consider a character. Otherwise I'll just define my own character encoding with a single character that maps to the ASCII for an entire program that solves the problem, and then decode that. \$\endgroup\$ – Adrian Petrescu Apr 23 '11 at 22:20
  • 2
    \$\begingroup\$ @Adrian Petrescu: that's easily solved by requiring that the encoding already exist at the time the challenge is posed. \$\endgroup\$ – Lowjacker Apr 23 '11 at 22:52
  • \$\begingroup\$ @Lowjacker Sure, but that seems to be a pretty arbitrary way to resolve this. \$\endgroup\$ – Adrian Petrescu Apr 23 '11 at 23:09
  • 5
    \$\begingroup\$ @Adrian, The advantage of unicode when using characters vs bytes has been acknowledged for a long time. In my opinion it doesn't make sense for the question to be tagged Kolmogorov while asking for characters. It should be counting bytes. It's up to the question asker to be careful about these terms. \$\endgroup\$ – gnibbler Apr 24 '11 at 22:04
10
\$\begingroup\$

Ruby 1.9, 88 87 84 80

puts b=[*?a..?z],:qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz,b.reverse
\$\endgroup\$
10
\$\begingroup\$

Bash, 82

echo {a..z}
echo qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz
echo {z..a}
\$\endgroup\$
9
\$\begingroup\$

Python, 97 96 "characters"

Taking your use of the word "characters" liberally, here's some python that uses 16-bit unicode characters to encode 3 normal characters each. The program is a total of 96 characters, 35 of which are the weirdest unicode characters I've ever seen.

for i in range(104):print chr((ord(u'ࠠᒃ⃦ⵉ��割廕��匓�เ᳅ⵉૹ�懬ࣅű傎ᱨ�⤰〷�弙劶��ⶍKᓇࡤ^A'[i/3])>>i%3*5&31)+97),

I'm not sure the unicode garbage will come though correctly, so here's a python program to generate the above python program:

#!/usr/bin/python                                                                                                                                                                 
import codecs
f=codecs.open('alpha.py','w','utf-8')
f.write('#!/usr/bin/python\n')
f.write('# coding=utf-8\n')
f.write('for i in range(104):print chr((ord(u\"')
S='''abcdefghijklmnopqrstuvwxyzqwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvzzyxwvutsrqponmlkjihgfedcbaa'''
for i in xrange(0,104,3):
 n=32*32*(ord(S[i+2])-97)+32*(ord(S[i+1])-97)+ord(S[i+0])-97
 f.write(u'%c'%n)
f.write('"[i/3])>>i%3*5&31)+97),\n')
\$\endgroup\$
9
\$\begingroup\$

Bash, 72

echo {a..z} qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz {z..a}

EDIT: removed tr -d.

Credits: Alexander, Roger.

\$\endgroup\$
  • 2
    \$\begingroup\$ Rules allow you to omit |tr -d ' ', saving 10 characters and making this version a leader at the moment of writing :-) \$\endgroup\$ – Alexander Gladysh Apr 24 '11 at 0:04
  • \$\begingroup\$ @Alexander, Cool ;-) did not know that. Thanks to @Roger though for pointing me in the right direction. \$\endgroup\$ – asoundmove Apr 24 '11 at 5:07
  • \$\begingroup\$ I was trying to find a more elegant solution with some sort of polynomial with powers of primes and modulo (or in other words find a simple enough permutation function that works through that sequence)... but can't spend the sort of time required for such a solution, so I'll leave it at that. Plus it'd be pretty hard to express concisely. \$\endgroup\$ – asoundmove Apr 24 '11 at 5:59
9
\$\begingroup\$

Golfscript, 64 chars

"qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz".$2%\1$-1%

Note: also 64 bytes. Actually, playing with Unicode and base changes seems counterproductive because base is too long a keyword.

\$\endgroup\$
6
\$\begingroup\$

Windows PowerShell, 89

Not particularly good, but at least shorter than the output string:

[char[]](65..90)
'qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz'
[char[]](90..65))

Way shorter now that I saw that there is a relaxation on whitespace. And a little shorter still, if I ignore case which I'm allowed to.

\$\endgroup\$
  • 2
    \$\begingroup\$ You've got an extra ) there. Should be 88. \$\endgroup\$ – Iszi Dec 13 '13 at 17:48
5
\$\begingroup\$

Golfscript, 76, 67 chars

123,97>+."qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz"\-1%
\$\endgroup\$
  • \$\begingroup\$ Use 123,97>+ to generate the initial alphabet. \$\endgroup\$ – Ventero Apr 23 '11 at 23:36
  • \$\begingroup\$ Thanks Ventero, I indeed saw that in your other post the other day. \$\endgroup\$ – YOU Apr 24 '11 at 6:14
4
\$\begingroup\$

CI - 92 chars

'a(1p'z((,0(4d)(.$)<)$)(0c0c.1+2p$.)>)$)qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz

CI ("Compiler/Interpreter") is a simple stack-based language I created for the "Self-Interpreting Interpreter" challenge (link to answer). I posted that answer about two hours before this challenge was posted. It's no GolfScript (which I still haven't gotten around to learning), as my goal was to make the interpreter short.

This program must be passed to the ci interpreter through standard input. The interpreter treats characters after a terminating ) as input to the program. My language doesn't support string literals, so stdin is taking its place.

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

Python 2.7.X - 103 characters ironically...

a='abcdefghijklmnopqrstuvwxyz'
print a,'qwertyuiopasdfghjklzxcvbnm pyfgcrlaoeuidhtnsqjkxbmwvz',a[::-1]

As it turns out, generating the alphabet in python takes more characters than hard-coding it. As does importing the alphabet. Gotta love a readability-centered language sometimes.

\$\endgroup\$
  • 1
    \$\begingroup\$ You don't need the space between the QWERTY and DVORAK strings, it would be 1 character less. \$\endgroup\$ – Lowjacker Apr 23 '11 at 18:57
  • \$\begingroup\$ true, but python automatically appends a space between each item in the comma-separated printing list, so the space is my personal sacrifice to the alter of readable output. \$\endgroup\$ – arrdem Apr 23 '11 at 20:55
  • \$\begingroup\$ You could use the + instead of , and save that space. \$\endgroup\$ – Martin Ueding Apr 23 '11 at 22:21
3
\$\begingroup\$

C — 133 chars

Shortened version from Casey:

main(i){char a[105];strcpy(a+26,"qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz");for(i=0;i<26;)a[i]=a[103-i]=i+++65;puts(a);}

Whitespaced:

main(i) {
    char a[105];
    strcpy(a+26, "qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz");
    for(i=0;i<26;)
        a[i]=a[103-i]=i+++65;
    puts(a);
}

Transposed output

Here is a version that does transposed output, for fun. 134 chars.

main(i){char*a="qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz";for(i=0;i<26;i++,a++)printf("%c%c%c%c\n",i+65,*a,*(a+25),90-i);}

Whitespaced:

main(i){
  char*a="qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz";
  for(i=0;i<26;i++,a++)
    printf("%c%c%c%c\n",i+65,*a,*(a+25),90-i);
}

Prints:

AqmZ
BwpY
CeyX
DrfW
EtgV
FycU
GurT
HilS
IoaR
JpoQ
KaeP
LsuO
MdiN
NfdM
OghL
PhtK
QjnJ
RksI
SlqH
TzjG
UxkF
VcxE
WvbD
XbmC
YnwB
ZmvA
\$\endgroup\$
  • \$\begingroup\$ Still does not fit, of course. \$\endgroup\$ – Alexander Gladysh Apr 23 '11 at 23:24
  • 1
    \$\begingroup\$ by declaring i as global and putting strcpy(...) to the first block of the for loop you get 129. still too much though. \$\endgroup\$ – bebe Jul 11 '14 at 21:20
3
\$\begingroup\$

J

x=:(97+/i.26){a.
x
261329910883437428257896643x A.x
247073478763191548160234722x A.x
(_1+/-i.26){x

My first experience with J. The idea is simply to use the canonical (lexicographic) number of the required permutation; unfortunately this takes more characters than hard-coding it. But if one could find some arithmetic expression (using powers and whatnot) yielding the magic numbers, it could be shortened.

\$\endgroup\$
  • \$\begingroup\$ 261329910883437428257896643 has the prime factorization 7*601*991*213987797*292923318887 so there are no powers in this one. \$\endgroup\$ – Jerry Jeremiah Mar 23 '16 at 21:35
3
\$\begingroup\$

Python, 90 unicode chars

#coding:u8
print u"扡摣晥桧橩汫湭灯牱瑳癵硷穹睱牥祴極灯獡晤桧歪穬捸扶浮祰杦牣慬敯極桤湴煳歪扸睭究祺睸當獴煲潰浮歬楪杨敦捤慢".encode("u16")[2:]

run at ideone - http://ideone.com/R2dlI or codepad - http://codepad.org/lp77NL9w

\$\endgroup\$
  • 2
    \$\begingroup\$ Actually, it only has 52 "characters". \$\endgroup\$ – Peter Olson Apr 24 '11 at 15:21
3
\$\begingroup\$

Javascript 139 121

new:

q='qwertyuiopasdfghjklzxcvbnm'
a=q.split('').sort()
alert(a.join('')+q+'pyfgcrlaoeuidhtnsqjkxbmwvz'+a.reverse().join(''))

old:

a=[]
a[26]='qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz'
for(i=0;i<26;i++)a[i]=a[52-i]=String.fromCharCode(i+65)
alert(a.join(''))
\$\endgroup\$
  • \$\begingroup\$ You could also have 121 with: alert((a=(q='qwertyuiopasdfghjklzxcvbnm').split('').sort()).join('')+q+'pyfgcrlaoeuidhtnsqjkxbmwvz'+a.reverse().join('')) \$\endgroup\$ – WallyWest Dec 17 '13 at 5:06
2
\$\begingroup\$

Lua — 111 characters

Beats C and C++! :-)

print'abcdefghijklmnopqrstuvwxyzqwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvzzyxwvutsrqponmlkjihgfedcba'

"Clever" version in Lua

129 characters

q='qwertyuiopasdfghjklzxcvbnm'a={q:byte(1,-1)}table.sort(a)a=q.char(unpack(a))print(a,q,'pyfgcrlaoeuidhtnsqjkxbmwvz',a:reverse())

Whitespaced:

q='qwertyuiopasdfghjklzxcvbnm'
a={q:byte(1,-1)}
table.sort(a)
a=q.char(unpack(a))
print(a,q,'pyfgcrlaoeuidhtnsqjkxbmwvz',a:reverse())
\$\endgroup\$
2
\$\begingroup\$

C - 163 135 chars

This doesn't meet the requirements as it clocks in at over 104 characters, but it was fun to make. Maybe someone will have some suggestions.

main(i){char a[105];strcpy(&a[26],"qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz");for(i=0;i<26;)a[i]=a[103-i]=i+++65;puts(a);}

This compiles on GCC 4.5.1 (others untested). Yay for omitting #includes, return types, and variable declarations! Hardcoding would've resulted in a shorter program, but that isn't any fun.

Whitespaced version:

main(i) {                                                                                   
    char a[105];                                                                        
    strcpy(&a[26], "qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz");                 
    for(i=0;i<26;)                                                                          
        a[i]=a[103-i]=i+++65;                                                               
    puts(a);                                                                                
}

C - 124 122 lame

Here is the lame hardcoded version, and it still doesn't make the cut.

main(){puts("abcdefghijklmnopqrstuvwxyzqwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvzzyxwvutsrqponmlkjihgfedcba");}
\$\endgroup\$
  • \$\begingroup\$ Use puts() instead printf in second case — 2 chars less. \$\endgroup\$ – Alexander Gladysh Apr 23 '11 at 23:11
  • \$\begingroup\$ And replace while with puts(a); in first case, dropping *p=a; — 138 chars instead of 163. \$\endgroup\$ – Alexander Gladysh Apr 23 '11 at 23:13
  • \$\begingroup\$ Awesome suggestions! I had totally forgotten about puts. Changed. \$\endgroup\$ – Casey Apr 24 '11 at 0:28
2
\$\begingroup\$

PHP 88 bytes

<?=$a=join(range(a,z)),~Žˆš‹†Š–žŒ›™˜—•”“…‡œ‰‘’†™˜œ“žšŠ–›—‹‘ŒŽ•”‡’ˆ‰…,strrev($a);
\$\endgroup\$
2
\$\begingroup\$

J - 69 char

'pyfgcrlaoeuidhtnsqjkxbmwvz'(,~|.)&(,\:~)'mnbvcxzlkjhgfdsapoiuytrewq'

Explanation:

  • (,\:~) y - Sort y in descending order (\:~), and append (,) that to y.

  • x (,~|.) y - Reverse (|.) y, and append that to the front of x.

  • x F&G y - Execute (G y) F (G y), that is, perform F on the results of applying G to the arguments.

So, all together, we append the alphabet, backwards, to both the Dvorak and reverse-QWERTY strings, then reverse the QWERTY/alphabet one and put that in front of the Dvorak/alphabet one.

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

Bash, 64

I'm very late to the party, but I have a 64 character solution. Program needs to be saved to disk to work

echo {a..z} $(sed 1d $0|base64) {z..a};exit
««·+¢¢–¬uø!ŽIsÅËÛžjr~+•ªº'a¶{*ŽL[›ó

How it works:

{a..z} and {z..a} are pretty self explanatory, but basically that just prints every character in that respective range.

$(sed 1d $0|base64) outputs the program, ignores the first line, then passes it through a base64 encoder (as some other examples have done).

The reason this is shorter than other similar examples...

...is because the {a..z} ranges are shorter than base64 encodings, so I only need to base64 encode half the string. And because I'm reading the binary data from file rather than storing it in a string, I don't need to escape any character in code.

How to recreate this script:

If the code doesn't copy/paste correctly from Stack Exchange to your text editor then run the following in your command line (shell agnostic):

echo 'echo {a..z} $(sed 1d $0|base64) {z..a};exit' > alphabetgolf
echo 'qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz' | base64 -d >> alphabetgolf

Then to run:

bash alphabetgolf
\$\endgroup\$
2
\$\begingroup\$

05AB1E, 25 bytes

AžW.•8t”a$äJÚ₁вƒüu¯Cê•AR»

Try it online!

Explanation

A                          # Push alphabet                    
 žW                        # Push qwerty string
   .•8t”a$äJÚ₁вƒüu¯Cê•     # Push compressed dvorak string
                      AR   # Push reversed alphabet
                         » # Join entire stack with newlines
\$\endgroup\$
1
\$\begingroup\$

C++

It's kind of sad when the shortest way to do something in a language is to hard-code it.

#include <iostream>

int main()
{
 std::cout<<"abcdefghijklmnopqrstuvwxyzqwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvzzyxwvutsrqponmlkjihgfedcba";
}
\$\endgroup\$
  • \$\begingroup\$ You don't need to output the linefeeds. \$\endgroup\$ – Lowjacker Apr 23 '11 at 20:21
  • \$\begingroup\$ @Low: Doh! I forgot to remove those when I took out the line breaks I realized I didn't need. Thanks for pointing that out. \$\endgroup\$ – John Apr 23 '11 at 20:23
  • \$\begingroup\$ This is a very obvious solution, and it surpasses the maximum length requirement. \$\endgroup\$ – Peter Olson Apr 24 '11 at 0:35
  • \$\begingroup\$ std::cout is shorter that using namespace std, and you can skip void. \$\endgroup\$ – Alexander Gladysh Apr 24 '11 at 0:42
  • \$\begingroup\$ @Alex: Thanks for pointing that out. \$\endgroup\$ – John Apr 24 '11 at 2:18
1
\$\begingroup\$

J (77)

(,|.@(26&{.))(,~/:~@(26&{.))'qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz'

Shaved off 3 characters by using a variable:

(,|.@a)(,~/:~@(a=.26&{.))'qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz'

Shaved off 2 more characters by using a value-level approach:

(|.a),~t,~a=./:~26{.t=.'qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz'
\$\endgroup\$
1
\$\begingroup\$

Haskell (95)

main=putStr$['a'..'z']++"qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz"++['z','y'..'a']

Perl (51)

There's no rule that says I can't.

use LWP::Simple;print get("http://bit.ly/fGkflf");
\$\endgroup\$
1
\$\begingroup\$

Q (68)

.Q.a,"qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz",(|:).Q.a

Outputs:

"abcdefghijklmnopqrstuvwxyzqwertyuiopasdfghjklzxcvbnmpyfg     
crlaoeuidhtnsqjkxbmwvzzyxwvutsrqponmlkjihgfedcba"

Tried to find an improvement on hard-coding the middle two but didn't come up with one.

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

K - 69 char

b,a,|b:a@<26#a:"qwertyuiopasdfghjklzxcvbnmpyfgcrlaeouidhtnsqjkxbmwvz"

Explanation:

  • 26#a: - Assign the two keyboard layouts to a, and then take the first 26 characters.

  • b:a@< - Sort a and assign that to b: < provides the permutation for an ascending sort, and @ lets us index a in order to sort it.

  • b,a,| - Append in a row b, then a, then the reverse (|) of b.

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

Pyth, 57

G"qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz"VG

Alphabet, string, reversed alphabet. G is the alphabet. Print is implicit.

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

Dyalog APL, 60 bytes

⎕A'QWERTYUIOPASDFGHJKLZXCVBNMPYFGCRLAOEUIDHTNSQJKXBMWVZ',⌽⎕A

Prints:

  ABCDEFGHIJKLMNOPQRSTUVWXYZ  QWERTYUIOPASDFGHJKLZXCVBNMPYFGCRLAOEUIDHTNSQJKXBMWVZ ZYXWVUTSRQPONMLKJIHGFEDCBA

Which is permitted as per OP:

The output is not case-sensitive, and you can add or omit newlines or spaces wherever you wish.

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

Jelly, 36 bytes (non-competing)

Øa;Øq;“pyfgcrlaoeuidhtnsqjkxbmwvz”;U

Try it online!

Explanation:

Øa;Øq;“pyfgcrlaoeuidhtnsqjkxbmwvz”;U    |
Øa;                                     | alphabet
   Øq;                                  | list with all rows of the qwerty keyboard
      “pyfgcrlaoeuidhtnsqjkxbmwvz”;     | string
                                   U    | reverse
\$\endgroup\$
1
\$\begingroup\$

05AB1E, 60 59 bytes

AÂ"qwertyuiopasdfghjklzxcvbnm""pyfgcrlaoeuidhtnsqjkxbmwvz"»

Try it online!

- pushes the bifurcated alphabet.

"qwertyuiopasdfghjklzxcvbnm""pyfgcrlaoeuidhtnsqjkxbmwvz" - Pushes qwerty and drovak.

» - Prints stack.

05AB1E, 57 bytes (If you don't care about random \n)

AÂ"qwertyuiopasdfghjklzxcvbnmpyfgcrlaoeuidhtnsqjkxbmwvz"»

Try it online!

\$\endgroup\$
  • \$\begingroup\$ In the first example, you can save a byte by replacing "" with a newline. \$\endgroup\$ – Neil A. May 22 '17 at 0:26

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.