43
\$\begingroup\$

Short and sweet description of the challenge:
Based off ETAOIN SHRDLU, your challenge is to write the shortest program or function in any language that outputs the 26 letters of the English alphabet based on their frequency in the input.

Really long, dry and thorough specification:

  • Your program/function will receive as input a string of text, which will contain one or more uppercase and/or lowercase letters and may also contain punctuation, numerals, symbols, and other non-alphabetic characters.
  • The program/function must output only the 26 UPPERCASE letters of the English alphabet, including those that do not appear in the input, ordered from most to least frequent based on how many times they appear in the input.
  • Edit: The frequency is calculated case-insensitively, but the output must be in uppercase.
  • If two or more letters have the same frequency, they may be in any order.
  • No other output, such as whitespace, is allowed.
  • Edit 7/1/2014: Based on feedback, I am amending this rule. The only other output that is allowed is optional leading and/or trailing whitespace, such as a trailing newline. No other output is allowed.
  • Undefined behavior is allowed for input that does not contain any letters.

The winner will be picked 7 days from now, so get those fingers typing!


Example input:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent vitae erat velit. Mauris gravida euismod libero ut tincidunt. Phasellus elit dui, consectetur et egestas in, aliquam vitae diam. Donec eget varius ante. Vestibulum cursus diam aliquet, egestas orci quis, placerat dolor. Proin vel nisi lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Aliquam erat volutpat. Etiam libero tortor, ornare id dui eget, posuere dignissim libero. Pellentesque commodo consequat volutpat. Integer hendrerit sapien libero, vel viverra augue facilisis sit amet. Quisque consectetur eget nisl quis dignissim. Ut lacinia pretium quam a placerat.
Morbi sed interdum risus, nec pretium lectus. Morbi imperdiet est id accumsan molestie. Duis sed fermentum nisl. Nunc vitae augue mattis, dictum lectus vel, accumsan nisl. Sed ultricies adipiscing rhoncus. Vivamus eu lacus a enim venenatis eleifend. Praesent consectetur tortor non eleifend ultricies. Mauris et odio posuere, auctor erat at, fringilla est. Proin in vestibulum erat. Maecenas congue commodo ante vel varius. Sed tempus mi ut metus gravida, nec dictum libero dapibus. Morbi quis viverra elit. Ut pharetra neque eget lacus tincidunt dictum. Fusce scelerisque viverra tellus et pretium.
Fusce varius adipiscing odio. Nulla imperdiet faucibus sem, at rhoncus ipsum adipiscing vitae. Phasellus imperdiet congue lacus et mollis. Nullam egestas mauris magna, et mollis lectus varius ut. Sed sollicitudin adipiscing dolor, vel elementum elit laoreet molestie. Aliquam nec nulla vel sem ultrices ullamcorper. Nullam nec felis magna. Duis sodales orci non justo aliquam tempus. Integer mi diam, tempor sed vulputate et, varius et nunc. Vestibulum sodales ipsum id mi pharetra, ut convallis mi accumsan. Sed dictum volutpat vestibulum.
Quisque ac dolor sagittis, aliquam libero at, euismod enim. Nulla ullamcorper posuere nulla vitae varius. Nam at dolor non libero elementum pellentesque in in lorem. Fusce porttitor turpis in quam placerat varius. Donec lorem orci, condimentum eu sapien sit amet, aliquet commodo magna. Quisque sed lectus sit amet arcu euismod accumsan et non nunc. Phasellus placerat congue metus, feugiat posuere leo dictum quis. Sed ultricies feugiat eros dignissim bibendum.
Mauris scelerisque consectetur libero eget varius. Aenean neque nunc, ullamcorper vitae orci in, auctor ornare sapien. Nam lacinia molestie imperdiet. Nam vitae mattis nibh. Vestibulum consequat tellus ac nisi sagittis pulvinar. Nullam mollis ornare quam, et venenatis leo porttitor sit amet. Nulla urna neque, dignissim non orci ut, volutpat ultrices erat. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Pellentesque vestibulum tellus nec eros faucibus porta.

Example output:

EITUSALNROMCDPVGQBFHJKWXYZ

Note: there is a 5 way tie between KWXYZ for that input.

Edit:

The competition is over! Thanks to everyone who participated. And now for the winner(s!): Both Dennis' CJam and isaacg's Pyth answers came in at a whopping 19 characters. (Sorry, but I'm not going to accept either of the answers because I think it would be unfair to the other.) Edit: Taking Dennis' advice, I'm going to mark his answer as accepted because his was the first to reach 19 characters. Honorable mentions go to Ilmari Karonen's third-place Golfscript answer at 22 chars as well as undergroundmonorail's 75-char Python answer that got the most upvotes. Once again, thanks to everyone who participated!

\$\endgroup\$
  • \$\begingroup\$ Is frequency measured for the upper case letters of the input only? \$\endgroup\$ – Howard Jun 30 '14 at 23:06
  • 2
    \$\begingroup\$ @IlmariKaronen yes newlines count as whitespace so that would not be allowed. \$\endgroup\$ – Abraham Jul 1 '14 at 1:47
  • 8
    \$\begingroup\$ @Abraham: IMO; if a trailing newline (specifically) is allowed for some languages, it should be allowed generally for all languages; not the least because a text stream should be terminated by a newline followed by EOF. \$\endgroup\$ – Williham Totland Jul 1 '14 at 12:15
  • 3
    \$\begingroup\$ @WillihamTotland based on the number of upvotes your comment has, I will modify the rules to allow a trailing newline. \$\endgroup\$ – Abraham Jul 1 '14 at 20:49
  • 1
    \$\begingroup\$ What to do if there're two answers with the shortest code? suggests awarding the green checkmark to the earlier solution. isaacg posted his answer first, I golfed mine to 19 bytes first. Whichever tie breaker you pick will be fine by me, but not having an accepted answer at all is a little anti-climatic in my opinion. \$\endgroup\$ – Dennis Jul 7 '14 at 23:33

45 Answers 45

2
\$\begingroup\$

Java 8, 171 169 154 139 138 bytes

s->{int x=26,a[]=new int[96],i,l;for(int c:s)a[c&~32]++;for(;x-->0;System.out.printf("%c",l),a[l]=-1)for(i=l=65;i<91;i++)l=a[i]>a[l]?i:l;}

Surprised there wasn't a Java answer yet.

-27 bytes thanks to @OlivierGrégoire.
-6 bytes thanks to @Nevay.

Explanation:

Try it here.

s->{               // Method with character-array parameter and no return-type
  int x=26,        //  Counter-integer, starting at 26
  a[]=new int[96], //  Integer array with 96x 0
  i,l;             //  Index integers
  for(int c:s)     //  Loop (1) over the input-array
    a[c&~32]       //   Convert the character to uppercase, and use it's index in the array
             ++;   //   and increase the integer at that current index by 1
                   //  End of loop (1) (implicit / single-line body)
  for(;x-->0       //  Loop (2) from 26 down to 0 (exclusive)
      ;            //    After every iteration:
       System.out.printf("%c",l+65),
                   //     Print the highest frequency uppercase letter
       a[l]=-1)    //     And then change it's frequency to -1, since we're done with it
    for(i=l=65;    //   Reset both `i` and `l` to 65
        i<91;i++)  //   Inner loop (3) from 65 to 91 (exclusive)
      l=a[i]>a[l]? //    If the current frequency is larger than the `l`'th frequency:
         i         //     Change `l` to the current index `i`
        :          //    Else:
         l;        //     Leave `l` the same
                   //   End of inner loop (3) (implicit / single-line body)
                   //  End of loop (2) (implicit / single-line body)
}                  // End of method
\$\endgroup\$
  • 1
    \$\begingroup\$ System.out.printf("%c",l+65) saves a few bytes. \$\endgroup\$ – Olivier Grégoire Oct 24 '17 at 12:50
  • 1
    \$\begingroup\$ @OlivierGrégoire Sigh.. I checked if System.out.printf("%c",c) saves any bytes compared to System.out.print((char)c) in another challenge a few hours ago, which it didn't. So I didn't even consider it here anymore.. Obviously it works here due to (l+65) vs l+65.. Thanks! \$\endgroup\$ – Kevin Cruijssen Oct 24 '17 at 12:56
  • \$\begingroup\$ 164 bytes: s->{int x=26,l,a[]=new int[91],i;s.chars().forEach(c->a[c&=~32]-=(64-c&c-91)>>-1);for(;x-->0;System.out.printf("%c",l),a[l]=-1)for(i=l=65;i<91;i++)l=a[i]>a[l]?i:l;} \$\endgroup\$ – Nevay Oct 24 '17 at 13:05
  • \$\begingroup\$ 154 bytes (including @Nevay's changes). Using a char[], as usual ;-) \$\endgroup\$ – Olivier Grégoire Oct 24 '17 at 13:11
  • 1
    \$\begingroup\$ 139 bytes assuming ASCII input (changed length of a to 96 and -=(65-c&c-91)>>-1 to ++). \$\endgroup\$ – Olivier Grégoire Oct 24 '17 at 13:41
1
\$\begingroup\$

Scala 184 170 136 132

 def c(s:String){print((('A'to'Z').mkString+s).filter(_.isLetter).groupBy(x=>x.toUpper).toSeq.sortBy(-_._2.size).map(_._1).mkString)}

Full Version

  def c(s: String) {
    print((('A' to 'Z').mkString + s).filter(_.isLetter).groupBy(x => x.toUpper).toSeq.sortBy(-_._2.size).map(_._1).mkString)
  }
\$\endgroup\$
  • 1
    \$\begingroup\$ You could replace (for(c<-65 to 90)yield c.toChar) with ('A'to'Z'), .length with .size, and the remaining for ... yield with .map \$\endgroup\$ – Dan Getz Jul 3 '14 at 0:20
  • \$\begingroup\$ And one more character by def f(...)=print(...) instead of def f(...){print(...)} \$\endgroup\$ – Dan Getz Jul 3 '14 at 0:24
  • \$\begingroup\$ @DanGetz thanks for your suggestions, i implemented it ! I have not added "=" since I m not returning anything, i m printing in func itself. \$\endgroup\$ – Sikorski Jul 3 '14 at 13:14
  • \$\begingroup\$ In Scala def f(...): Unit = { ... } is considered the normal form of a function that returns nothing, with def f(...) { ... } simply another way of writing the same thing. \$\endgroup\$ – Dan Getz Jul 3 '14 at 14:11
  • \$\begingroup\$ If isLetter here does the same thing as Java's Character.isLetter, then it's allowing a lot more than 26 characters through the filter. \$\endgroup\$ – Trejkaz Jul 6 '14 at 12:33
1
\$\begingroup\$

R, 111 characters

Another solution in R (using only base R):

f=function(x)cat(names(sort(table(factor(strsplit(gsub("[^A-Z]","",toupper(x)),"")[[1]],LETTERS)),d=T)),sep="")

Explanation:

toupper(x) makes the input upper case.
gsub("[^A-Z]","",...) gets rid of everything non alphabetical.
strsplit(...,"")[[1]] splits the character string into a vector of single characters.
factor(...,LETTERS) makes a factor out of it with uppercase letters as possible levels.
table(...) build a frequency table of each factor levels.
sort(...,d=T) sorts it according to its values, in decreasing order.
names(...) takes the names of the elements (aka the upper case letters).
cat(...,sep="") prints the result to stdout with no separator.
And everything wrapped into a function to make it directly comparable with djurio solution.

Usage:

> f=function(x)cat(names(sort(table(factor(strsplit(gsub("[^A-Z]","",toupper(x)),"")[[1]],LETTERS)),d=T)),sep="")
> f("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent vitae erat velit. Mauris gravida euismod libero ut tincidunt. Phasellus elit dui, consectetur et egestas in, aliquam vitae diam. Donec eget varius ante. Vestibulum cursus diam aliquet, egestas orci quis, placerat dolor. Proin vel nisi lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Aliquam erat volutpat. Etiam libero tortor, ornare id dui eget, posuere dignissim libero. Pellentesque commodo consequat volutpat. Integer hendrerit sapien libero, vel viverra augue facilisis sit amet. Quisque consectetur eget nisl quis dignissim. Ut lacinia pretium quam a placerat.
+ Morbi sed interdum risus, nec pretium lectus. Morbi imperdiet est id accumsan molestie. Duis sed fermentum nisl. Nunc vitae augue mattis, dictum lectus vel, accumsan nisl. Sed ultricies adipiscing rhoncus. Vivamus eu lacus a enim venenatis eleifend. Praesent consectetur tortor non eleifend ultricies. Mauris et odio posuere, auctor erat at, fringilla est. Proin in vestibulum erat. Maecenas congue commodo ante vel varius. Sed tempus mi ut metus gravida, nec dictum libero dapibus. Morbi quis viverra elit. Ut pharetra neque eget lacus tincidunt dictum. Fusce scelerisque viverra tellus et pretium.
+ Fusce varius adipiscing odio. Nulla imperdiet faucibus sem, at rhoncus ipsum adipiscing vitae. Phasellus imperdiet congue lacus et mollis. Nullam egestas mauris magna, et mollis lectus varius ut. Sed sollicitudin adipiscing dolor, vel elementum elit laoreet molestie. Aliquam nec nulla vel sem ultrices ullamcorper. Nullam nec felis magna. Duis sodales orci non justo aliquam tempus. Integer mi diam, tempor sed vulputate et, varius et nunc. Vestibulum sodales ipsum id mi pharetra, ut convallis mi accumsan. Sed dictum volutpat vestibulum.
+ Quisque ac dolor sagittis, aliquam libero at, euismod enim. Nulla ullamcorper posuere nulla vitae varius. Nam at dolor non libero elementum pellentesque in in lorem. Fusce porttitor turpis in quam placerat varius. Donec lorem orci, condimentum eu sapien sit amet, aliquet commodo magna. Quisque sed lectus sit amet arcu euismod accumsan et non nunc. Phasellus placerat congue metus, feugiat posuere leo dictum quis. Sed ultricies feugiat eros dignissim bibendum.
+ Mauris scelerisque consectetur libero eget varius. Aenean neque nunc, ullamcorper vitae orci in, auctor ornare sapien. Nam lacinia molestie imperdiet. Nam vitae mattis nibh. Vestibulum consequat tellus ac nisi sagittis pulvinar. Nullam mollis ornare quam, et venenatis leo porttitor sit amet. Nulla urna neque, dignissim non orci ut, volutpat ultrices erat. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Pellentesque vestibulum tellus nec eros faucibus porta.")
EITUSALNROMCDPVGQBFHJKWXYZ
> f("Based off ETAOIN SHRDLU, your challenge is to write the shortest program or function in any language that outputs the 26 letters of the English alphabet based on their frequency in the input.")
ETNAHORISULFGPBCDYMQWJKVXZ
\$\endgroup\$
1
\$\begingroup\$

K4, 16 bytes

Solution:

.Q.A@>+/.Q.a=/:_

Try it online! (Note this is an oK port/demonstration as there is no TIO for K4).

Example:

Note that the input string is stored as variable 'x' for ease:

q)\
  .Q.A@>+/.Q.a=/:_x
"EITUSALNROMCDPVGQBFHJKWXYZ"

Explanation:

.Q.A@>+/.Q.a=/:_  / the solution
               _  / convert to lowercase
            =/:   / equals each right (/:)
        .Q.a      / lowercase alphabet "a..z"
      +/          / sum
     >            / descending sorted indices
    @             / index into
.Q.A              / uppercase alphabet "A..Z"

Notes:

In q/kdb+ it would be 27 bytes:

.Q.A idesc sum .Q.a=/:lower
\$\endgroup\$
1
\$\begingroup\$

Retina, 81 75 bytes (not competing)

The language (especially the Sort mode) is newer than the challenge.

;
{T`;L`L`.$
}`[^Z]$
$0$0
T`l`L
Os`.
[^A-Z]

(.)\1*
$0¶
O#$^`.*
$.0
¶

D`.

Try it online

Explanation:

;               # Add the entire alphabet plus a bunch of semicolons into the input
{T`;L`L`.$          # (so that all letters are included in the input at least once)
}`[^Z]$             #
$0$0                #
T`l`L           # Translate all lowercase into uppercase
Os`.            # Sort all characters by code point
[^A-Z]          # Remove non-letters

(.)\1*          # Separate same characters by newlines
$0¶
O#$^`.*         # Sort backwards numerically by the length
$.0
¶               # Remove newlines

D`.             # Remove excess letters
\$\endgroup\$
0
\$\begingroup\$

Lua, 226 Bytes

I'm coming in long after this contest has ended, but I though it would be fun to do :). Also, it may be one of the longest submission down here, but actually took me some time to find a clever way to do it. It may still be golfable I'll explain it below, but right now, here's the code:

f,t={},{}(...):upper():gsub("%u",function(c)c=c:byte()-64 f[c]=f[c]and f[c]+1or 1 end)for i=1,26
do c=(i+64 ..''):char()f[i]=f[i]and f[i]or 0 x=f[i]t[x]=t[x]and c..t[x]or c end
for i=#...,0,-1 do io.write(t[i]and t[i] or'')end

It's a full program, taking its input via command-line argument as a string.

Ungolfed and explanations

f={}                       -- f will be our array for counting iteration
t={}                       -- t will be the sorted array
(...):upper()              -- convert the input in all uppercase
     :gsub("%u",function(c)-- then iterate over each uppercase letter in it
  c=c:byte()-64            -- set c at its position in the alphabet
  f[c]=f[c]                -- if f[c] is set (letter already encountered)
       and f[c]+1          -- increment it
       or 1                -- else, we set it to 1
end)
   -- At that point, wev'e counted each character, let's sort based on occurence!
for i=1,26                 -- iterate on the size of the alphabet
do
  c=(i+64 ..''):char()     -- c is the character corresponding to the current i
  f[i]=f[i]and f[i]or 0    -- if c wasn't in the input, initialise a counter at 0
  x=f[i]                   -- set x to the number of occurence of c
  t[x]=t[x]                -- if t[x] is set, two or more letter have the same count
       and c..t[x]         -- so concatenate the string in t[x] with the new letter
       or c                -- else, just set it
end

for i=#...,0,-1            -- iterate from the size of input to 0
do
    io.write(t[i]          -- if we have i occurence of letter(s)
         and t[i]          -- output them
         or'')             -- else, output an empty string
end

This algorythm is really inefficient. It works because arrays don't exist in lua, we only use tables, which are associative arrays. Which means I can map t[123456]='B' even if t[1] doesn't exist. It makes sorting the number of occurence really fast, but if you want to find them, the time will depend on the size of the input you gave to the program.

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

Perl, 43 bytes

adding 1 for -n, as usual.

I know variable variables are generally a bad idea and shouldn't be used, but hey it's code golf :)

#!perl -n
${uc$_}++for/\w/g}{print+sort{$$b-$$a}A..Z
\$\endgroup\$
0
\$\begingroup\$

Mathcad, 102 "bytes"

Mathcad doesn't index strings, so the function f converts the string to a vector of its equivalent character codes (subtracting A's code to aid indexing). f then counts each occurence of the letters A..Z (taking 32 of the values of codes >= "a" to implicitly convert case).

Then there's a verbose sequence of nested functions that sort the character codes by count in ascending order, extract the sorted codes in reverse order and add the "A" offset back, and convert the resulting character code vector back into a string.

enter image description here

I interpret Mathcad "bytes" as the number of keyboard / menu operations necessary to create a Mathcad symbol.

  • Identifier names, eg submatrix, are typed in letter-by-letter, hence the byte count = number of characters in the name.
  • Type ' to add a balanced pair of parentheses
  • Array indices are entered by typing the array name and then the character '[' followed by the indices. For c25, this would be the 4 bytes c [ 2 5.
  • Type ctl-shft-# A to create a "for loop"; this results in a for programming construct that automatically displays the for keyword and the element-of symbol, plus three placeholders. The placeholders are for the iteration variable, it's range and the main body of the loop, respectively.
  • Type ] to add a new programming line. See the image below ...

enter image description here

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

Factor, 327 261 248 bytes

:o

CONSTANT: a "ABCDEFGHIJKLMNOPQRSTUWXYZ"
: s ( s -- s ) >array [ 1string ] map ;
[ >upper s dup a s [ [ = ] curry ] map [ [ count ] curry ] map [ call( x -- x ) ] with map [ a s union natural-sort ] dip zip [ last ] sort-with [ first ] map "" join ]

Writing this took a while since I'm still learning the language, but it was fun.

Run the above code, then do "string" swap call to call the lambda. Less golfed:

USING: arrays ascii assocs combinators kernel sequences
  sequences.generalizations sets sorting strings ;
IN: input-freq

CONSTANT: alph "ABCDEFGHIJKLMNOPQRSTUWXYZ"

: alphabet-counter ( -- alph-quot )
  alph string>array [
    [ = ] curry
  ] map [
    [ count ] curry
  ] map ;

: string>array ( str -- array )
  >array [ 1string ] map ;

: freq-find ( str -- freqmap )
  >upper string>array dup alphabet-counter
  [ call( x -- x ) ] with map
  [ alph string>array union natural-sort ] dip zip
  [ last ] sort-with [ first ] map "" join ;
\$\endgroup\$
0
\$\begingroup\$

k4, 21 bytes

  {.Q.A@<<>#:'.Q.a#=_x}
  {.Q.A@<<>#:'.Q.a#=_x}@,/0:`:e
"EITUSALNROMCDPVGQBFHJKWXYZ"

This approach uses the builtin alphabetic constants .Q.a (the lowercase letters) and .Q.A (the uppercase) to do the filtering and translation back to upper. The process:

  • _: convert to lowercase (leaves non-letters untouched)
  • =: group into associative array of characters and their indices
  • .Q.a#: take only lowercase letters (includes empty lists for characters that did not occur)
  • #:': count each value in the array
  • >: get the keys of the array ordered by its values, descending
  • <<: find the position where each item would appear if the list were sorted
  • .Q.A@: apply that list of positions back to the list of uppercase letters

The last two steps are conceptually a bit tricky; they basically allow you to permute one list according to another. See the q documentation for rank for more details.

(Note that if we stop before the translation back to uppercase, we have a correct result, but in lowercase:

  {>#:'.Q.a#=_x}@,/0:`:e
"eitusalnromcdpvgqbfhjkwxyz"

and a code length of 14!)

\$\endgroup\$
  • \$\begingroup\$ You can change the << to . to get the values out of the dictionary before sorting for a 1 byte saving: {.Q.A@>.#:'.Q.a#=_x} \$\endgroup\$ – streetster Oct 24 '17 at 14:04
0
\$\begingroup\$

PHP 135 Bytes

I know I'm late but I wanted to post anyway:

function a($b){
  $b=strtoupper($b);
  foreach(range('A','Z') as $c){
   $d[$c]=substr_count($b, $c);
  }  
  arsort($d);
  return implode(array_keys($d));
}
echo a($z); //let $z be the supplied string.

golfed:

function a($b){$b=strtoupper($b);foreach(range('A','Z') as $c){$d[$c]=substr_count($b, $c);}arsort($d);return implode(array_keys($d));}echo a($z); 
\$\endgroup\$
  • \$\begingroup\$ The echo is how the function is called, so I'm omitting that from the byte count. Just as a CLI script wouldn't include the command. \$\endgroup\$ – TecBrat Mar 30 '16 at 10:38
0
\$\begingroup\$

Floroid - 37 bytes

Ba:''.y(t(R(P,w(65,91)),fi=a.fk.fm))D

A little late to the party, but here it is. An Floroid port of @undergroundmonorails answer.

This language was made some time after this challenge, therefore this isn't competing.

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

PHP, 92+1 bytes (late entry)

$r=count_chars(strtoupper($argn));arsort($r);foreach($r as$c=>$n)$c>64&$c<91&&print chr($c);

Run as pipe with -nR or try it online.

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

05AB1E, 9 bytes (Non-competing)

lAΣ¢}ÙRáu

Try it online!


More interesting 10-byte version:

05AB1E, 10 bytes

l{γéJAìÚRá

Try it online!

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

VB.net

Dim r = String.Join("",( From a In "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
                         Group Join c In t On a Equals c Into Group
                         Order By Group.Count Descending
                       ).Select(Function(g) g.a))
\$\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.