Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Commonmark migration
Source Link

#Pyth, 66 bytes

Pyth, 66 bytes

oxc."ayÇæ£ðÐ\~@iF[2BÍÐ:Yë)^ksTTã"2s@LN,03

Try it online here, or verify all the test cases at once here.

The colours in the list can be uniquely identified by taking the characters at index 0 and 3, assuming modular indexing. This results in the following mapping:

rr -> red
yl -> yellow
ge -> green
bw -> brown
sr -> scarlet
bc -> black
or -> ochre
pc -> peach
ry -> ruby
ov -> olive
vl -> violet
fn -> fawn
la -> lilac
gd -> gold
cc -> chocolate
mv -> mauve
ca -> cream
cm -> crimson
sv -> silver
re -> rose
ar -> azure
lo -> lemon
rs -> russet
gy -> grey
pp -> purple
wt -> white
pk -> pink
on -> orange
be -> blue

Full explanation:

oxc."..."2s@LN,03Q Implicit: Q=eval(input())
 Trailing Q inferred, dictionary string replaced with ... for brevity
o Q Order the elements of Q, as N, using:
 ,03 [0,3]
 @LN Get the characters at the above indices in N
 s Concatenate into a string
 The above is result {1}
 ."..." The compressed dictionary string
 c 2 Split into chunks of length 2
 x Get the index of {1} in the above
 Implicit print of sorted list

#Pyth, 66 bytes

oxc."ayÇæ£ðÐ\~@iF[2BÍÐ:Yë)^ksTTã"2s@LN,03

Try it online here, or verify all the test cases at once here.

The colours in the list can be uniquely identified by taking the characters at index 0 and 3, assuming modular indexing. This results in the following mapping:

rr -> red
yl -> yellow
ge -> green
bw -> brown
sr -> scarlet
bc -> black
or -> ochre
pc -> peach
ry -> ruby
ov -> olive
vl -> violet
fn -> fawn
la -> lilac
gd -> gold
cc -> chocolate
mv -> mauve
ca -> cream
cm -> crimson
sv -> silver
re -> rose
ar -> azure
lo -> lemon
rs -> russet
gy -> grey
pp -> purple
wt -> white
pk -> pink
on -> orange
be -> blue

Full explanation:

oxc."..."2s@LN,03Q Implicit: Q=eval(input())
 Trailing Q inferred, dictionary string replaced with ... for brevity
o Q Order the elements of Q, as N, using:
 ,03 [0,3]
 @LN Get the characters at the above indices in N
 s Concatenate into a string
 The above is result {1}
 ."..." The compressed dictionary string
 c 2 Split into chunks of length 2
 x Get the index of {1} in the above
 Implicit print of sorted list

Pyth, 66 bytes

oxc."ayÇæ£ðÐ\~@iF[2BÍÐ:Yë)^ksTTã"2s@LN,03

Try it online here, or verify all the test cases at once here.

The colours in the list can be uniquely identified by taking the characters at index 0 and 3, assuming modular indexing. This results in the following mapping:

rr -> red
yl -> yellow
ge -> green
bw -> brown
sr -> scarlet
bc -> black
or -> ochre
pc -> peach
ry -> ruby
ov -> olive
vl -> violet
fn -> fawn
la -> lilac
gd -> gold
cc -> chocolate
mv -> mauve
ca -> cream
cm -> crimson
sv -> silver
re -> rose
ar -> azure
lo -> lemon
rs -> russet
gy -> grey
pp -> purple
wt -> white
pk -> pink
on -> orange
be -> blue

Full explanation:

oxc."..."2s@LN,03Q Implicit: Q=eval(input())
 Trailing Q inferred, dictionary string replaced with ... for brevity
o Q Order the elements of Q, as N, using:
 ,03 [0,3]
 @LN Get the characters at the above indices in N
 s Concatenate into a string
 The above is result {1}
 ."..." The compressed dictionary string
 c 2 Split into chunks of length 2
 x Get the index of {1} in the above
 Implicit print of sorted list
Source Link
Sok
  • 6.2k
  • 1
  • 19
  • 30

#Pyth, 66 bytes

oxc."ayÇæ£ðÐ\~@iF[2BÍÐ:Yë)^ksTTã"2s@LN,03

Try it online here, or verify all the test cases at once here.

The colours in the list can be uniquely identified by taking the characters at index 0 and 3, assuming modular indexing. This results in the following mapping:

rr -> red
yl -> yellow
ge -> green
bw -> brown
sr -> scarlet
bc -> black
or -> ochre
pc -> peach
ry -> ruby
ov -> olive
vl -> violet
fn -> fawn
la -> lilac
gd -> gold
cc -> chocolate
mv -> mauve
ca -> cream
cm -> crimson
sv -> silver
re -> rose
ar -> azure
lo -> lemon
rs -> russet
gy -> grey
pp -> purple
wt -> white
pk -> pink
on -> orange
be -> blue

Full explanation:

oxc."..."2s@LN,03Q Implicit: Q=eval(input())
 Trailing Q inferred, dictionary string replaced with ... for brevity
o Q Order the elements of Q, as N, using:
 ,03 [0,3]
 @LN Get the characters at the above indices in N
 s Concatenate into a string
 The above is result {1}
 ."..." The compressed dictionary string
 c 2 Split into chunks of length 2
 x Get the index of {1} in the above
 Implicit print of sorted list

AltStyle によって変換されたページ (->オリジナル) /