text:
PI window encryption
This is a simple encryption method that uses PI digits to encode a message, the method is simple:
The key is just a positive integer that indicates where the window starts then:
Given a string to encrypt, containing only lowercase letters, no spaces, you take its length, then you find the Nth digit of PI and then proceeds to shift every letter to the right for the amount indicated by the digit.
For example, if the key is 2 and I want to encode house, I take a window of 5 digits from the second one: 14159 and then it becomes:
h -> i
o -> s
u -> v
s -> x
e -> n

a.- Your program/function/algorithm will receive two parameters, an string composed only of lowercase letters with no spaces and the key, which will be just a positive integer between 1 (1 refers to 3) and 1000, which could be more or less as I'm not quite sure how long does it take to compute PI with said accuracy because:
b.- You must compute PI yourself in your code, here is a neat webpage to compare with: Pi Day. The input should never have you calculate PI beyond the 1000 digit, meaning that length(message)+key <= 1000.
By computing Pi, I mean not harcode it in your code (silly for a code golf) nor use any embedded constant in your code nor any trigonometric identity (2*acos(0)) nor any web reference.
c.- The output will be just the encrypted string.
This is a code golf question, shorter code wins!
I'll be accepting the winning answer at July 14th, 2014.

What happens when letters are shifted past the end of the alphabet?  Does wrap-around to the beginning of the alphabet occur or something else?

Yes, you just start over from the beginning.

What counts as "compute yourself"? ArcCos(-1)?

Please read this question and its comments very carefully.  Then please edit your question to specify what you mean by "compute PI yourself"

Is 3 the zeroth or the first digit of pi?

I explained better what I wanted to say by computing it yourself and pointed that 3 is the first digit.

Key 1 and the the string aaaaa will give dbebf with a = 0, b = 1, etc. By replacing the letters by the numbers, we can compute Pi by using the answers to this question. :-)

This is effectively two challenges whose scores you sum: computing digits of pi and doing Caesar shifts by a series of offsets. The first has been done, so I'd suggest just doing the second, perhaps by allowing the embedded constant pi. There has been a similar letter-shifting question though: http://codegolf.stackexchange.com/questions/678/decipher-a-vigen%C3%A8re-ciphertext

This actually seems like a really smart encryption algorithm, why isn't this widely used (except with a more complicated constant like e^pi or something less recognizable)?

@ASKASK you'd need trillions or maybe more digits of Pi to protect against brute forcing/dictionary attacks

Does the pi calculation need to have a reasonable runtime? Any bound on how many digits we might need to compute?

@DigitalTrauma Here is what I'm thinking: Along with the encoded message there is some sort of numerical key (maybe the date or something like that) which is passed into a function (ex: f(x)=e^(pi*x)) which generates a number of infinite digits that appear in no obvious order. The attacker would need to know the exact function to generate the number in order to know the pattern at which the letters were being shifted. How could a brute force/dictionary figure that out?

Any limit on the string length?

Just addressed the string length more clearly and, as answers are already posted I don't think it's wise to split it into two challenges.

CJam - 51
l_,li(2e4,-2%{2+_2/@*\/2e2000+}*Ab><]z{~+_'z>26*-}%

Example input:
zebra
20

Output:
dkdxe

This works for (string length) + key <= 2000, but is quite slow for the online interpreter (still fast with the java interpreter).
Here's a version that works up to 200 and you can try at http://cjam.aditsu.net/ without waiting too long:
l_,li(2e3,-2%{2+_2/@*\/2e200+}*Ab><]z{~+_'z>26*-}%

Python - 370
Ok, nice one, finally got the pi thing working with thanks to link1 and link2.
from decimal import *
def f(s,n):
 j=len(s)
 getcontext().prec=j+n+5
 d=Decimal
 e=d(0)
 for k in range(0,j+n+5):
  e+=(d(16)**(-k)*(d(4)/(8*k+1)-d(2)/(8*k+4)-d(1)/(8*k+5)-d(1)/(8*k+6)))
 c=`e`.split("'")[1].replace('.','')
 t=''
 for i,l in enumerate(s):
  o=ord(l)
  for v in[0,32]:
   if 64+v<o<91+v:
    l=chr(((o-65-v)+int(c[i+n-1]))%26+65+v)
  t+=l
 print t

Example output:
>>> f('house',2)
isvxn

and another:
Wimt fcy d dnyh uhkvkv qhvadil

     >>> f('This was a very secret message',1)

JavaScript - 167 173 176
Thanks to Michael for the clever representation of powers of 16.
This can calculate PI up to the 16-th digit.
function e(s,o){for(p=i=n=r='',m=1;s[+i];m<<=4,n>o?r+=String.fromCharCode(s.charCodeAt(i)-+-(1e15*p+'')[o+i++]):0)p-=(4/((d=8*n++)+1)-2/(d+=4)-1/++d-1/++d)/m;return r}

The test case:
> e("house",2)
"isvxn"

What about m=1 and m<<=4 instead of m='0x1' and m+=0 ? Saves 3 bytes.

Python - 321 304 288 285
from decimal import*
d=Decimal
s,n=raw_input(),input()
l=len(s)
getcontext().prec=n+l
print''.join([chr((v-97)%26+97)for v in map(sum,zip(map(ord,s),map(int,str(sum([(d(4)/(8*k+1)-d(2)/(8*k+4)-d(1)/(8*k+5)-d(1)/(8*k+6))/16**k for k in range(0,l+n)])).replace('.','')[n-1:n+l])))])

Most of the golfed version is easy to read and understand. The final line is ungolfed below:
# Calculate PI using the BBP formula.
pi = 0
for k in range(0,l+n):
    pi += (d(1)/(16**k))*((d(4)/(8*k+1))-(d(2)/(8*k+4))-(d(1)/(8*k+5))-(d(1)/(8*k+6)))

# Remove the decimal point in PI.
pi = str(pi).replace('.','')

result = []
# For the ASCII sum of each pair of letters in `s` and its digit in PI
for v in sum(zip(map(ord, s), map(int, pi))):
    result.append((v-97)%26+97)

# Convert all the ordinal values to characters
print ''.join(map(chr, result))

EDIT #1: simplified my module arithmetic.
EDIT #2: refactored the BBP formula.

Haskell - 265 267 bytes (no IO)
p=g(1,0,1,1,3,3)where g(q,r,t,k,n,l)=if 4*q+r-t<n*t then n:g(10*q,10*(r-n*t),t,k,div(10*(3*q+r))t-10*n,l) else g(q*k,(2*q+r)*l,t*l,k+1,div(q*(7*k+2)+r*l)(t*l),l+2)
e i s=zipWith(\k c->toEnum$fromIntegral k+fromEnum c::Char)(take(length s)$drop(fromIntegral$i-1)p)s

p is a golfed version of the algorithm that can be found at http://rosettacode.org/wiki/Pi#Haskell
e is the encoding function :
λ> e 2 "house"
"isvxn"

It does not loop around if an index is outside of the lowercase alphabet. This means that some other characters can slip in the encoded string :
"Sfufv#Kork(mq}nns j{i&sv&xitmujtu&vey|h{xljej|35.)(\"%(\"\"&\" %\"\"$()$ ''\"&'!)$'(\"&($(\"& !$'&)]hrs\"ow olih7$Tdkhnsj ns&qpdlw}oplwmxbipn#o{ur!vhbp\"mitj/"

Unfortunately, it takes several seconds with offsets greater than 10 000 to compute the output. Fortunately, when using the same offset multiple times, the digits only have to be computed the first time.
Bonus - Decoding
d i s=zipWith(\k c->toEnum$fromEnum c-fromIntegral k::Char)(take(length s)$drop(i-1)p)s

Again if we test with isvxn :
λ> d 2 "isvxn"
"house"

Made a typo in your bonus section. d 2 "isvsn" should be d 2 "isvxn"

Fixed. Thanks for noticing.

CoffeeScript - 148 Chars/Bytes
My first ever Code Golf
Unfortunately It does not support wrapping (So a z would end up being punctuation)

e=(m,k)->(m.split('').map (v,i)->String.fromCharCode v.charCodeAt()+parseInt Math.PI.toString().replace('.','').slice(k-1,m.length+k-1)[i]).join('')

Demo on CSSDeck
Called with:

alert e 'house', 2

isvxn

Did you read the whole question, as it clearly states that you are not allowed to "use any embedded constant in your code"?


text:
“Disprove” Fermat's Last Theorem
Write a program, in the language of your choice, that appears to successfully find a counterexample to Fermat's Last Theorem.  That is, find integers a, b, c > 0 and n > 2 such that an + bn = cn.
Of course, you can't really do it, unless there's a flaw in Andrew Wiles' proof.  I mean fake it, by relying on

integer overflow
floating-point rounding error
undefined behavior
data types with unusual definitions of addition, exponentiation, or equality
compiler/interpreter bugs
or something along those lines.

You may hard-code some or all of the variables a, b, c, or n, or search for them by doing loops like for a = 1 to MAX.
This isn't a code golf; it's a contest to find clever and subtle solutions.

actually, you can have ones as all of them besides the exponent, which has to be 3 or higher. So, 1^3+1^3=1^3 its that simple.

@Siver: 1³+1³=2; 1³=1; 2≠1

J
Actually, Fermat did make quite a blunder: It's actually wrong for any b, c or n if a is 1:
   1^3 + 4^3 = 5^3
1
   1^4 + 5^4 = 11^4
1
   1^9 + 3^9 = 42^9
1

 Maybe just maybe, Fermat's precedence rules weren't strictly right to left.

+1 Strictly right to left indeed. Just for people who read left to right; normal notation for the last one would be 1^(9 + (3^(9 = (42^9))))

Ah...so any expression that starts with 1^ evaluates to 1.

Sneaky, my brain was about to melt until I saw @TheRare's comment

@german_guy Glad to be of help.

Is this an intended feature of J? This is the kind of thing that would really drive people insane.

@qwr In J, all evaluation is from right to left, with some exceptions. It sounds weird but is actually pretty neat.

@dan04 Not strictly speaking true. 1^i.5 evaluates to 1 1 1 1 1.

TI-Basic
1782^12+1841^12=1922^12

Output (true)
1

@dan04 What is the reference here?

http://photos1.blogger.com/blogger/4608/663/1600/homer.fermat.jpg

I saw that episode so often, never noticed that. Nice catch!

This answer only works as written with TI-89-flavor TI-Basic. On a TI-84+ SE, the code has a syntax error, because that version of TI-Basic does not allow spaces. But the answer still works on an older calculator if you remove spaces, writing 1782^12+1841^12=1922^12.

If I evaluate 1782^12+1841^12 or 1922^12 separately, each outputs “2.541210259e39”, suggesting a floating-point rounding error. But if I try to view the hidden significant digits, fPart((1782^12+1841^12)/10^33) outputs .2586147, while fPart((1922^12)/10^33) outputs .2593147. I’m confused how the calculator made the rounding mistake for the large numbers, yet outputs different numbers when the large numbers are re-divided.

Doesn't the TI-89 work in exact mode by default if you don't have decimal points in your numbers?

+1 for using TI-Basic, it was my first programming language :)

Calculators are good at math. This obviously must be true.

@ThaneBrimhall That's the irony, a calculator failing a simple math problem

Java
This Fermat guy must have been sleeping. I get hundreds of solutions to the equations. I merely converted my Excel formula to a Java program.
public class FermatNoMore {
    public static void main(String[] args) {
        for (int n = 3; n < 6; n++)
            for (int a = 1; a < 1000; a++)
                for (int b = 1; b < 1000; b++)
                    for (int c = 1; c < 1000; c++)
                        if ((a ^ n + b ^ n) == (c ^ n))
                            System.out.println(String.format("%d^%d + %d^%d = %d^%d", a, n, b, n, c, n));
    }
}

 The ^ operator actually means XOR in Java, as opposed to exponentiation in typical plain-text

Any chance on an elaboration on why this works?

@Vality: ^ in Java is xor, not power.

this technically works on almost any C-based languages

C++
#include <cstdlib>
#include <iostream>

unsigned long pow(int a, int p) {
  unsigned long ret = a;

  for (int i = 1; i < p; ++i)
    ret *= a;

  return ret;
}

bool fermat(int n) {
  // surely we can find a counterexample with 0 < a,b,c < 256;
  unsigned char a = 1, b = 1, c = 1;

  // don't give up until we've found a counterexample
  while (true) {
    if (pow(a, n) + pow(b, n) == pow(c, n)) {
      // found one!
      return true;
    }

    // make sure we iterate through all positive combinations of a,b,c
    if (!++a) {
      a = 1;
      if (!++b) {
        b = 1;
        if (!++c)
          c = 1;
      }
    }
  }

  return false;
}

int main(int argc, char** argv) {
  if (fermat(std::atoi(argv[1])))
   std::cout << "Found a counterexample to Fermat's Last Theorem" << std::endl;
}

Compiled with clang++ -O3 -o fermat fermat.cpp, tested with Ubuntu clang version 3.4.1-1~exp1 (branches/release_34) (based on LLVM 3.4.1):
./fermat 3
Found a counterexample to Fermat's Last Theorem

We obviously found a, b, c > 0 so that a3 + b3 = c3 (this also works for n = 4, 5, 6, ...).

 Printing a, b and c might prove a bit difficult though ...

Needs -lstdc++ to build on my PC.  But do make sure to include the -O3 flag.  It doesn't work on -O0.

@dan04: Oops, forgot the ++ in clang++.

By the way, this is not a compiler bug. C (and C++) standard allows to do anything here, as val.u can overflow (it would be different if it would be uint32_t instead). Besides, this code also uses union in incorrect way (according to standard, you cannot write to one field, and read the other field), but this is allowed by many compilers (according to their documentation).

@xfix The same thing happens when val.u is made uint32_t or the overflow is checked. In fact, I just used the union to make the code a bit shorter (otherwise it'd require extra checks to correctly increment/reset a, b and c). I've changed the code to remove the union, and it still produces the same output.

The reason this is allowed is a section of the C++ standard that says:
A loop that, outside of the for-init-statement in the case of a for statement,

makes no calls to library I/O functions, and
does not access or modify volatile objects, and
performs no synchronization operations (1.10) or atomic operations (Clause 29)

may be assumed by the implementation to terminate.

@dan04 That exact wording has actually been removed from the standard in a later draft, see US 38 in http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3196.htm - but of course, it's only been generalized. This is the reason why printing out a,b,c (or anything, for that matter) in fermat() makes the function never return.

Argh I was so going to post that one. For anybody who's confused: John Regehr has a nice explanation here.

@Voo That's not too useful without a link. John Regehr, if I even found the right blog, has 273 posts tagged computer science.

@raptortech97 You missed the link that's under the word here in my comment :-) It's post 161 from the URL though if I'd to guess.

@Voo Oh yeah now I feel really stupid...

Java
It looks like the theorem holds for n=3, but I found counterexamples for n=4:
public class Fermat {
    public static int p4(final int x) {
        return x * x * x * x;
    }

    public static void main(final String... args) {
        System.out.println(p4(64) + p4(496) == p4(528));
    }
}

Output:
true

Explanation:

 Even if the numbers seem small, they overflow when raised to the 4th power. In reality, 644 + 4964 = 5284 - 234, but 234 becomes 0 when restricted to int (32 bits).

Can you explain this?

@AnubianNoob done

Python
import math
print math.pow(18014398509481984,3) + math.pow(1, 3) \
      == math.pow(18014398509481983,3)

 Who says that c must be greater than a and b?

It prints True because math.pow returns floating-point numbers, and these do not have enough precision to get the correct answer, False.

GolfScript
# Save the number read from STDIN in variable N and format for output.

:N"n="\+

{
  [{100rand)}3*] # Push an array of three randomly selected integers from 1 to 100.
  .{N?}/         # Compute x**N for each of the three x.
  +=!            # Check if the sum of the topmost two results equals the third.
}{;}while        # If it doesn't, discard the array and try again.

# Moar output formatting.

~]["a=""\nb=""\nc="""]]zip

This approach finds a bunch of different solutions. For example:
$ golfscript fermat.gs <<< 3
n=3
a=43
b=51
c=82

How it works

 The first line should start with a ~ to interpret the input. Instead of, e.g., the number 3 , variable N contains the string 3\n.
 While 2 3 ? calculates 3, 2 N ? pushes the index of a character with ASCII code 2 in N (-1 for not found).
 This way, 43 N ? and 82 N ? push -1 and 51 N ? pushes 0 (51 is the ASCII character code of 3).
 Since -1 + 0 = -1, the condition is satisfied and (43,51,82) is a "solution".

C
Well of course you folks are all finding counterexamples, you keep on getting integer overflows. Plus, you're being really slow by iterating on c as well. This is a much better way to do it!
#include <stdio.h>
#include <math.h>

int main(void) {
  double a, b, c;
  for (a = 2; a < 1e100; a *= 2) {
    for (b = 2; b < 1e100; b *= 2) {
      c = pow(pow(a, 3) + pow(b, 3), 1.0/3);
      if (c == floor(c)) {
        printf("%f^3 + %f^3 == %f^3\n", a, b, c);
      }
    }
  }
  return 0;
}

 double might be great on the range, but it's still a bit lacking in precision...

C
We all hate integer overflows, so we'll use a small exponent n and some floating point conversions. But still the theorem would not hold for a = b = c = 2139095040.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>

int a, b, c;
int n;

int disprove(int a, int b, int c, int n)
{
    // Integers are so prone to overflow, so we'll reinforce them with this innocent typecast.
    float safe_a = *((float *)&a);
    float safe_b = *((float *)&b);
    float safe_c = *((float *)&c);

    return pow(safe_a, n) + pow(safe_b, n) == pow(safe_c, n);
}

int main(void)
{
    srand(time(NULL));

    a = b = c = 2139095040;
    n = rand() % 100 + 3;

    printf("Disproved for %d, %d, %d, %d: %s\n", a, b, c, n, disprove(a, b, c, n) ? "yes" : "no");
}

Output:
Disproved for 2139095040, 2139095040, 2139095040, 42: yes
Disproved for 2139095040, 2139095040, 2139095040, 90: yes

 In IEEE 754, the number 2139095040, or 0x7F800000, represents positive infinity in single-precision floating point types. All pow(...) calls would return +Infinity, and +Infinity equals +Infinity. An easier task would be to disprove the Pythagorean theorem by using 0x7F800001 (Quiet NaN) which is not equal to itself according to the standard.

Javascript
var a, b, c, MAX_ITER = 16;
var n = 42;
var total = 0, error = 0;

for(a = 1 ; a <= MAX_ITER ; a++) {
  for(b = 1 ; b <= MAX_ITER ; b++) {
    for(c = 1 ; c <= MAX_ITER ; c++) {
      total++;
      if(Math.pow(a, n) + Math.pow(b, n) == Math.pow(c, n)) {
        error++;
        console.log(a, b, c);
      }
    }
  }
}

console.log("After " + total + " calculations,");
console.log("I got " + error + " errors but Fermat ain't one.");

42 is magic, you know.
> node 32696.js
After 2176 calculations,
I got 96 errors but Fermat ain't one.

And also Wiles ain't one.

 Javascript Number is not big enough.

T-SQL
To disprove this Fermat guy's theorem, we just need to find a counter example.
It seems, he was super lazy, and only tried it for really small permutation. In fact, he wasn't even trying. I found a counter example in just 0 < a,b,c < 15 and 2 < e < 15. Sorry I'm a golfer at heart so I'll ungolf this code later!
with T(e)as(select 1e union all select (e+1) from T where e<14)select isnull(max(1),0)FROM T a,T b,T c,T e where e.e>2 and power(a.e,e.e)+power(b.e,e.e)=power(c.e,e.e)

Returns 1, meaning we found a counter example!

 The trick is that while the first e looks like an alias, it actually is a sneaky way of changing the data type of e from an int to a floating point type equivalent to a double. By the time we got to 14 we are beyond the precision of a floating point number so we can add 1 to it and we still don't lose anything. The minification is a nice excuse to explain away my seemingly silly double declaration of a column alias in the rcte. If I didn't do this it would overflow long before we got to 14^14.

JavaScript
It appears this guy was onto something alright. Onto drugs if you ask me. Given the constraints, no set of values can be found for which the theorem holds true.
var a = 1,
    b = 1,
    c = 1,
    n = 3,
    lhs = (a^n + b^n),
    rhs = c^n;

alert(lhs === rhs);

 As in Java, the ^ operator is the bitwise XOR operator in JavaScript. The correct way to calculate the power of a number is to use Math.pow.

For Fermat, the exponent(n) has to be >= 3.

Good point, the code still works though :)

Another BASIC counterexample
10 a = 858339
20 b = 2162359
30 c = 2162380
40 IF (a^10 + b^10) = c^10 THEN
50   PRINT "Fermat disproved!"
60 ENDIF

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
ETAOIN SHRDLU golf
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.
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.
The only other output that is allowed is optional leading or trailing whitespace, such as a trailing newline. No other output inclusing whitespace is allowed.
Undefined behavior is allowed for input that does not contain any letters.

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

Is frequency measured for the upper case letters of the input only?

@Howard, no, frequency is measured based on all letters but the output is in uppercase only

If we choose to use a function, how should the byte count be taken? In JavaScript, for example, f=function(){return} could be counted as 7 bytes (inner function: return), 18 bytes (anonymous function: function(){return}) or 20 bytes (named function: f=function(){return}).

@Dennis I think it's standard to include the function definition in the character count, so I would say go with your last example.

If I misinterpreted the spec (e.g. my example is wrong), please edit!

@durron597 The example is right on the mark, you da man!

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.

I knew this from NoSleep lol.

CJam, 21 19 bytes
qeu:A;'[,65>{A\-,}$

Try it online.
Example
$ cjam etaoin.cjam <<< "~XyxY YyxZ"
YXZABCDEFGHIJKLMNOPQRSTUVW

(no newline)
How it works
qeu:A; " Read from STDIN, convert to uppercase, save in the variable “A” and discard, ";
'[,    " Push an array of all ASCII characters before “[” (NUL to “Z”).               ";
65>    " Remove the first 64 characters (NUL to “@”).                                 ";
{      " Sort the array of characters by the following mapping:                       ";
  A\   " Swap the character with the string saved in variable “A”.                    ";
  -    " Remove all occurrences of the character from the string.                     ";
  ,    " Push the length of the string.                                               ";
}$     "                                                                              ";

More occurrences means more characters get removed, so the most frequent characters appear at the beginning of the array.

Very clever indeed.

Congratulations @Dennis on winning the contest!

Python 2 or 3 - 77 75 bytes
f=lambda s:''.join(sorted(map(chr,range(65,91)),key=s.upper().count))[::-1]

I had an answer before that grabbed input from STDIN, but I realized it was technically invalid. I used input() which gets only a single line, but the question's example input implies that it should handle multiple lines at once. To meet spec, I turned my answer into a function that takes a string argument. To my surprise, it was two bytes smaller! It didn't occur to me that print(...) and input() were longer than f=lambda s: and s.
This also makes the answer compatible with both Python 2 and Python 3. Originally it was only Python 3, because it used input() (which was called raw_input() in 2). Now that it's a function, it works in both.
Explained
                                  range(65,91)                              # The numbers 65 to 90
                          map(chr,range(65,91))                             # Convert to ASCII

                                                    s                       # The input string
                                                    s.upper()               # Convert to uppercase
                                                    s.upper().count         # Function literal for 'how many times the argument appears in the string'

                   sorted(map(chr,range(65,91)),key=s.upper().count)        # Sort by that function
           ''.join(sorted(map(chr,range(65,91)),key=s.upper().count))       # Concatenate to string
           ''.join(sorted(map(chr,range(65,91)),key=s.upper().count))[::-1] # Step through by -1 (i.e. reverse string)

  lambda s:''.join(sorted(map(chr,range(65,91)),key=s.upper().count))[::-1] # Make it a function (`return` is implicit for lambdas)
f=lambda s:''.join(sorted(map(chr,range(65,91)),key=s.upper().count))[::-1] # Give it a name

On the other hand, the comments in the explanation make me facepalm.  Welcome to CS 101!

@Izkata The important thing is that it shows you in which order to read the code. Because the best place to start reading golfed code is rarely obvious, especially when it gets a bit more complicated or terse than this.

Beautiful presentation!

Can't you shave off ~3 characters with def f(s):\n instead of f=lambda s:?

Can you save 5 chars by changing key=s to key=-s and deleting [::-1]?

@Izk My goal was to make it understandable to people who don't know python. I would never make comments like these in a real project.

@pat No, because I'd also have to use return. Also, FYI: Because this is only one line, the \n would be unnecessary.

@imm No. count isn't a variable or anything, it's a literal function. As cool as it would be to be able to multiply a function's return value by -1 by sticking a - in front, that's not a feature python has.

You can save 3 whole characters by using positional arguments and removing the slicing array reversal -- you have to specify None as the second (comparator), but that lets you specify 1 (as in True) to the reverse argument.

Bash, 65 bytes
(tr a-z A-Z;echo {A..Z})|fold -1|sort|uniq -c|sort -nr|tr -dc A-Z

Example
$ bash etaoin.sh <<< "~AbaB BbaC"
BACZYXWVUTSRQPONMLKJIHGFED

How it works
(              #
  tr a-z A-Z   # Turn lowercase into uppercase letters.
  echo {A..Z}  # Print all uppercase letters.
) |            #
fold -1 |      # Split into lines of length 1.
sort |         # Sort those lines (required for piping to uniq).
uniq -c |      # Print the frequencies of all lines.
sort -nr |     # Sort by frequency (reversed).
tr -dc A-Z     # Remove everything that's not an uppercase letter.

This is not locale portable, you need to force LC_COLLATE=C (or shorter, LC_ALL).

@ChrisDown Portability isn't generally a concern in code golf answers.

Without portability, what this answer does is not well defined.

@ChrisDown: I've tested a few strings and a few locales, but I couldn't find an example where uniq misbehaves for alphabetic characters. Could you show me one?

@ChrisDown This script is portable enough to run on OpenBSD using the BSD versions of fold, sort, tr, uniq, if the shell is bash or ksh93. Other shells, like zsh, fail to expand {A..Z}. All LC_COLLATE locales work, because OpenBSD only has LC_COLLATE=C.

Pyth 1.0.2, 19 20
=ZUwsVm;dSm[cZkk)UG

Try it here: http://ideone.com/fork/YlWpEJ
Learn more about Pyth here: http://esolangs.org/wiki/Pyth
Example:

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.

Gives:

TENOHARSIULGFPYDCBWQMZXVKJ

Explanation:
=ZUw: Convert input to uppercase and store in Z.
sV: Print the sum of the reverse of
m;d: The last entries of
S: Sorted by their first entry, in increasing order
m[cZkk): The lists [count of k in Z, k]
UG: For k in the uppercase letters.
Rough Python equivalent:
G='abcdefghijklmnopqrstuvwxyz'
Z=copy(upper(input()))
print(_sum(rev(_map(lambda d:d.pop(),sorted(_map(lambda k:_list(count(Z,k),k),upper(G)))))))

This is not entry, I just thought people might like to see it. In Pyth 1.0.4, the following program is a solution in 10 characters:
JUwo_cJNUG

Explanation:
JUw: Convert input to uppercase and store in J.
o: (Print) Sort by
_cJN: -1*(count of N in J)
UG: Over N in the uppercase letters.
It is not a legal solution because several of the changes from Pyth 1.0.2 to 1.0.4, including the addition of the o, sort by, function, were in response to this problem.

I suggest you to update the Pyth link to the official page of Pyth, if it exists.

@A.L. That is the official page of Pyth, until I put up an esolang entry.

Why do you need to store the input in a variable Z to refer to it once later? Would just putting the expression for Z in its place cause input to be read multiple times?

@xnor The position Z is used in is inside a lambda function, because it is in the first argument of a map, so it needs to be saved to a variable. Using Uw there would indeed result in input being read 26 times.

@isaacg see the rule change above allowing trailing newlines for everyone.

@Abraham Great, I think an even footing is a good way to go. I'll edit my answer accordingly.

@isaacg Yeah, i decided to change it based on the amount and direction of feedback I was getting

@isaacg: I asked this because GolfScript has a website: http://www.golfscript.com/golfscript/ In fact, I think that the source code of Pyth would be more interesting with code colorisation, if I remember correctly Codepad can do this.

@A.L Alright, Pyth is up on both esolang and on github. The github link is at the bottom of the esolang page, which is linked in the answer. Github does code colorization.

Thanks, I hope it will help Pyth to gain visibility and be used more and more for golfing.

Congratulations @isaacg on winning the contest!

Javascript (ES6) 119 117
Edit: (-2) Removed the need for toUpperCase using a case-insensitive RegEx in the split call.
a=prompt(f=x=>a.split(RegExp(x,'i')).length)
alert([...'ABCDEFGHIJKLMNOPQRSTUVWXYZ'].sort((b,c)=>f(c)-f(b)).join(''))

Alternative (same length): Condensed the sort and character counting into a single function.
a=prompt()
alert([...'ABCDEFGHIJKLMNOPQRSTUVWXYZ'].sort(f=(b,c)=>c?f(c)-f(b):a.split(RegExp(b,'i')).length).join(''))

As a function: 105 104
Edit: (-1) Condensed the sort and character counting into a single function.
F=a=>[...'ABCDEFGHIJKLMNOPQRSTUVWXYZ'].sort(f=(b,c)=>c?f(c)-f(b):a.split(RegExp(b,'i')).length).join('')

Interesting technique.

Splattering a string… delightful!

GolfScript, 22 chars
:?91,+-26>{.32+]?\-,}$

Try it online.
Explanation:

:? assigns the input string to the symbol ?.  (I use a punctuation symbol so that the following number 91 is not parsed as part of the symbol name.)
91, constructs a list of the numbers from 0 to 90 (ASCII code of Z).
+ appends this list to the input string, thereby converting it from an array of ASCII codes to a string (and conveniently also removing the input string from the stack).
-26> takes the last 26 characters of this string, producing a string containing the uppercase ASCII letters from A to Z.
The { }$ applies the code block to all the characters in the input string, and sorts those characters according to the result.
Inside the code block, . duplicates the character and 32+ converts the copy from uppercase to lowercase.  The ] collects these two characters into an array, ?\- takes the input string stored in ? and removes all occurrences of the characters in the array from it, and , counts the length of the remaining string, which will be the sort key.  The characters will be sorted in ascending order by this key, and thus in descending order by number of occurrences.

Looks like we had pretty much the same idea. Minor bug: The letter Z is missing. It should be 91,+-26>.

@Dennis: Ah, oops. Fixed, although who needs that letter anyway? :)

@IlmariKaronen Based on community feedback, I amended the rules to allow for a trailing newline (see the question for a complete description). Your score is now 22, rather than 25 :)

Haskell, 110 bytes
import Data.List
import Data.Char
a%f=compare(f a).f
f t=sortBy(% \c->length$filter((/=c).toUpper)t)['A'..'Z']

Example usage:
λ> 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"

What about (/=c) and getting rid of the 0-?

@Mauris nice catch! I edited it in and shaved off another character.

Ruby 2.0, 53 characters
EDIT: Fixed to work correctly with multiline strings, thanks @durron597!
f=->s{$><<(?A..?Z).sort_by{|c|-s.upcase.count(c)}*''}

Creates a function called f which can be used as follows:
f['jackdaws love my big sphinx of quartzzz']

Prints to STDOUT:
AZOSICGHEJKLMBFPQRDTUVWXYN

This answer is not correct. It gives this answer: EITASUROLNCMPDVQGBHFKJWXYZ for the example in the question

@durron597 Thanks, you are correct!  It wasn't handling multiline strings correctly - gets returns a line at a time.  It can be fixed by changing gets to gets$n but changing it into a function is 1 char shorter.

Perl, 54 46 bytes
UPDATE: after further optimizations it could be squeezed to 46 bytes:
(thx dennis for -n/{} hack; chinese perl goth for <=>->- hack)
s/./$h{uc$&}++/eg}{say sort{$h{$b}-$h{$a}}A..Z

It is to be run with run with perl -nE
Original solution (does not need special Perl options):
s/./$h{uc$&}++/egfor<>;print sort{$h{$b}<=>$h{$a}}A..Z

Verified in Perl 5.8.3, 5.14.2
If you get a warning, separate eg and for with a space (+1 char), if you mind
example usage:
$ python -c 'import this' | perl -le 's/./$h{uc$&}++/egfor<>;print sort{$h{$b}<=>$h{$a}}A..Z' 2>/dev/null
ETAISONLRHPBUCDYMFGXVWKZJQ

EXPLANATION: On each character (.) of each input line (for<>), apply a substitution "pattern", which in fact is evaluated as an expression (e flag of the s///), that increments an upcased (uc) character (./$& is shorter than more obvious (.)/$1) count in the (uninitialized) hash (%h). Then, the letter frequency hash is used in a sort comparison function to print out upper-case alphabet in the right order.

Shorter and no error messages: perl -ne 's/./$h{uc$&}++/eg}{print sort{$h{$b}<=>$h{$a}}A..Z'

Dennis: very interesting, it looks like a typo.. wth is this? i've had some variants using -n and END{}, but they were always longer.. feel free to update the answer, if you want

Dennis: OK, now i get it. breaking the imaginary (? probably not so) while loop. amazing

Yes, -n wraps while(<>){...} around the code. I avoid editing other users' code. Too easy to make a mistake, some things only work on some computers, etc.

Dennis: anyway, it's ingenious hack, i can't see it anywhere in the docs. please let me know if you have some links to discussions on this - it's difficult to search (i wish google could do regexp search)

perldoc perlrun has all the magic command-line switches.

Joe: i was talking about the }{ "injection", not just about the well known -n option. One might not expect that the code string actually technically is wrapped by the while loop code string before the execution, not only just that it somehow works like as if it was wrapped..

save two more chars: replace $h{$b}<=>$h{$a} with $h{$b}-$h{$a}

You can cut one more byte by using the -F option instead of -n: Try it online!

AppleScript, 278
I noticed that "a" = "A" is true in AppleScript. I can use this in code golf, but the rest of the script is too wordy. I used AppleScript 1.8.3.
This defines a function f. If you add f("a string") at the bottom of the script and run it in the Script Editor, it will show the result.
on c(n)
ASCII character(64+n)
end
on f(s)
set{a,r}to{{},""}
repeat with i from 1 to 26
set j to 0
repeat with b in s
if b&""=c(i)then set j to j+1
end
set a to a&j
end
repeat with j from 0 to(count s)
repeat with i from 1 to 26
if a's item i=j then set r to c(i)&r
end
end
r
end

Formatted and commented:
-- Returns nth letter of alphabet.
on c(n)
    ASCII character (64 + n)
end c

-- Returns letters in s sorted by frequency.
on f(s)
    -- a: list of letter counts
    -- r: resulting string
    set {a, r} to {{}, ""}

    -- For each letter from A to Z,
    -- count letters in string s.
    repeat with i from 1 to 26
        set j to 0
        repeat with b in s
            -- Can't use b = c(i), because
            -- b is a reference to a string
            -- and = never dereferences its
            -- operands. Get contents of b,
            -- here by coercing b to string.
            if b & "" = c(i) then set j to j + 1
        end repeat
        -- Set item i of a to count j.
        set a to a & j
    end repeat

    -- Sort letters by frequency.  Do a counting sort
    -- because AppleScript lacks a sort command.
    repeat with j from 0 to (count s)
        repeat with i from 1 to 26
            if a's item i = j then set r to c(i) & r
        end repeat
    end repeat
    r
end f

-- Example call:
f("Now is the time for all good men to come to the aid of their country.")
-- Result: "OTEIRNMHLFDCAYWUSGZXVQPKJB"

R, 123 bytes
The code is improved thanks to the suggestions by @RichieCotton.
text <- "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."

f=function(x){b=plyr::count(toupper(strsplit(x,"")[[1]]));c=merge(LETTERS,b,all.x=T);paste(c[order(-c$freq),1],collapse="")}

f(text)

Output:
> f(text)
[1] "ETNAHORISULFGPBCDYMQWJKVXZ"

@RichieCotton: I have rejected your suggested edit twice now. I don't know if you get notified with the reason for the reject vote, so if you read this: please provide golfing improvements in comments, so the OP can review them. Here is why: http://meta.codegolf.stackexchange.com/a/1619/8478

VBScript 181 109
Updated to use a completely different algorithm. Beats JavaScript!
Pretty:
dim b(99):i=ucase(inputbox(k))
for y=65to 90
    c=chr(y)
    a=len(replace(i,c,k))
    b(a)=c+b(a)
next
msgbox join(b,k)

Golfed:
dim b(99):i=ucase(inputbox(k)):for y=65to 90:c=chr(y):a=len(replace(i,c,k)):b(a)=c+b(a):next:msgbox join(b,k)

J 41 35 Bytes
(u:65+i.26)([\:[#/.~@,e.~#])toupper

Demo:
i=: 'This is a test to see whether this is still working'
(u:65+i.26)([\:[#/.~@,e.~#])toupper i
STIEHLORWAGKNBCDFJMPQUVXYZ

Explanation:
(u:65+i.26) & ( [ \: [ #/.~@,e.~#]) toupper) )
ABCDE...          |    |    |   |      uppercase the right argument
                  |    |    |   \copy from right only member from left
                  |    |     \append the left argument
                  |    \ Afterwards Count apperances of each letter
                  \ Sort the left according to the appearances

The key is to append the left array, such that all letters are available, and already in order. A funny consequence of using a noun as third tine to the fork is that it works as verb as well as as phrase.

SAS - 217 (I think)
Input should be placed on the line after the cards4 statement, or on the appropriate punch cards for your system. I think this approach saves a few characters vs. attempting to quote the input.
data a;
input;
S = upcase(compress(_INFILE_,,'ak'));
do i=1 to length(S);
l=substr(S,i,1);
output;
end;
cards4;
;;;;
run;
proc sql;
select l into :o separated by '' from
(select l, 1/count(l) as f from a group by l) order by f;
quit;

I'm aware that this doesn't meet the full spec, as it only returns characters that appear in the input string. I might need to rethink this a bit.

Doesn't meet the spec, but is still cool, so +1 :D

C++, 185 183 179 177 bytes
Not expected to win, of course (can C++ ever win?) but a fun exercise nonetheless.
#include <algorithm>
#include <stdio.h>
int f[256],p;main(){for(p=65;p<91;p++)f[p]=p;while(~(p=getchar()))f[p&95]+=256;p=256;std::sort(f,f+p);while(p--)f[p]&95&&putchar(f[p]);}

Explanation:
#include <algorithm>         // for std::sort
#include <stdio.h>           // for getchar, putchar
int f[256],p;                // declare an array of count-prefixed chars, and a counter
main(){
    for(p=65;p<91;p++)       // 65 == 'A', 91 == the character after 'Z'
        f[p]=p;              // set the character for the slot
    while(~(p=getchar()))    // read characters until EOF
        f[p&95]+=256;        // increment the packed count for the character stripped of the 'lowercase bit'
    p=256;                   // start a countdown
    std::sort(f,f+p);        // sort the array
    while(p--)               // do the countdown
        f[p]&95 &&           // if the masked-off character is set...
          putchar(f[p]);     // print it
}

Groovy - 130 123 115 112 98 92
As per @cfrick's advice (twice!):
f={('A'..'Z').collectEntries{c->[c,it.grep(~/(?i)$c/).size()]}.sort{-it.value}*.key.join()}

A small test (shamelessly stolen from @jpjacobs):
assert f('This is a test to see whether this is still working') ==
    'STIEHLORWAGKNBCDFJMPQUVXYZ'

And the proposed test is also passing

The function needs to output all 26 letters, not just those present in the input string.

@algorithmshark, indeed, my mistake, fixed

f={('A'..'Z').collectEntries{c->[c,it.toUpperCase().findAll(c).size()]}.sort{-it.value}.keySet().join()} for 104

another 6 bytes: it.grep(~/(?i)$c/) instead of it.toUpperCase().grep(c)

@cfrick Wow! Thanks again! That toUpperCase was bothering the hell out of me.

Jelly, 9 bytes
ØAŒuċ¥@ÞU

Explanation
ØAŒuċ¥@ÞU  Main Link
       Þ   Sort
ØA         The uppercase alphabet by
  Œuċ¥@    number of occurrences in the input:
  Œu       Uppercase
    ċ      Count occurrences
     ¥     Grammar: Last two links as a dyad
      @    Swap arguments
        U  Reverse (because sort sorts up)

This reads as "sort the uppercase alphabet by the number of occurrences in the input uppercased, reversed", which is a rather literal translation of the challenge :P
Try it online!
This challenge was linked to Jelly HyperTraining where we solved the challenge. I posted this because I was the first to reach 10 bytes.
-1 byte thanks to Erik the Outgolfer (JHT teacher)

9 bytes: ØAŒuċ¥@ÞU

@EriktheOutgolfer Oh cool, thanks!

8 bytes: ŒuØAċ@ÞU

Perl, 78 bytes
undef$/;$i=<>;$r{$i=~s/$_//gi}.=$_ for A..Z;print$r{$_}for sort{$b<=>$a}keys%r

Only the 26 uppercase ASCII letters without any white space are output in frequency order.
Tied characters are given in alphabetic order.

Result for the example in the question:
EITUSALNROMCDPVGQBFHJKWXYZ

Ungolfed:
# read input
# ----------
undef $/; # disable input separator
$i = <>;  # $i holds the complete input as one string

# analyze
# -------
# For each uppercase letter (A upto Z) its occurences are counted
# via the number of substitutions made by s/$_//gi. The lowercase
# letter is included via modifier "i".
#
# The occurrence count is then used as key for hash %r.
# The uppercase letter is appended to the value of that hash entry.
$r{$i =~ s/$_//gi} .= $_ for A..Z;

# output
# ------
# The hash keys are sorted numerically in reverse order by
# the specified sort function.
print $r{$_} for sort {$b<=>$a} keys %r

This might work for the example, bot not e.g. for echo -e 'x\ny\n\nz\n' output, which should return XYZABCDEFGHIJKLMNOPQRSTUVW, but yields XYABCDEFGHIJKLMNOPQRSTUVWZ instead. Guess why.. :)

@mykhal: Fixed.

T-SQL 178
Basically, this is my VBScript solution but implemented in SQL.
This is XML output abuse to concatenate a column. In practical use, it can be joined to an outer table to emulate GROUP_CONCAT functions in MySQL and others.
Declaring the @ variable:
DECLARE @ CHAR(1024)= 'enter your text here';

Code:
with y AS(
    SELECT UPPER(@)i,0l,91y
    UNION ALL
    SELECT i,len(replace(i,char(y-1),'')),y-1
    FROM y
    WHERE y>65
)
SELECT LTRIM(
(
    SELECT char(y)
    FROM y
    WHERE y<91
    ORDER BY l
    FOR XML PATH(''))
)

C# (and LINQ) 255 226 210 Bytes
Using Patrick Huizinga's advice, the query syntax is now shorter:
namespace System.Linq{class P{static void Main(string[]a){Console.Write((from c in(a[0]+"ABCDEFGHIJKLMNOPQRSTUVWXYZ").ToUpper()where c>'@'&&c<'['group c by c into g orderby-g.Count()select g.Key).ToArray());}}}

Explanation:
Console.Write(
    (from c //declare our range variable
       in (a[0] + "ABCDEFGHIJKLMNOPQRSTUVWXYZ").ToUpper() //declare the datasource
     where c > '@' && c < '[' //include only letters
     group c by c into g //run of the mill group by
     orderby -g.Count() //order by descending
     select g.Key //we only want the actual letters
     ).ToArray() //mash it all into an array
  );

Equivalent method syntax (217):
namespace System.Linq{class P{static void Main(string[]a){Console.Write((a[0]+"ABCDEFGHIJKLMNOPQRSTUVWXYZ").ToUpper().GroupBy(c=>c).OrderBy(c=>-c.Count()).Where(c=>c.Key>'@'&&c.Key<'[').Select(c=>c.Key).ToArray());}}}

Original post:

namespace System.Linq{class P{static void Main(string[]a){(a[0]+"ABCDEFGHIJKLMNOPQRSTUVWXYZ").ToUpper().GroupBy(c=>c).OrderByDescending(c=>c.Count()).Where(c=>c.Key>'@'&&c.Key<'[').ToList().ForEach(c=>Console.Write(c.Key));}}}

This is my first ever submission and I should be doing things at work
  but this just looked like so much fun because I felt like I could
  actually participate for once.
Explanation:
(a[0] + "ABCDEFGHIJKLMNOPQRSTUVWXYZ") //ensure each character appears once
  .ToUpper()
  .GroupBy(c => c) //get access to .Count()
  .OrderByDescending(c => c.Count())
  .Where(c => c.Key > '@' && c.Key < '[') //exclude anything other than letters
  .ToList() //Only lists have a .ForEach() :(
  .ForEach(c => Console.Write(c.Key)); //print output

I never use the method syntax for LINQ so this was a learning
  experience for me :) also thinking about it now I could save 2 bytes
  by replacing the character literals with their integer counterparts,
  but, meh.
Shortened thanks to tips from ProgramFOX and Num Lock :)
The equivalent query syntax (slightly longer):
(from c in (a[0]+"ABCDEFGHIJKLMNOPQRSTUVWXYZ").ToUpper() where c>'@'&&c<'[' group c by c into g orderby g.Count() descending select g.Key).ToList().ForEach(c=>Console.Write(c));

On a first look, you could save a lot of characters by naming your class just P instead of Program and string[]a instead of string[] args and c=>... instead of (c)=>....

Instead of two using statements, you can also put your class inside the System.Linq namespace, and remove both using statements. Then you can save some characters and it will still work fine.

@NumLock Right, didn't even think of that :) @ProgramFOX that won't save me anything because namespace is longer than using and the two extra {}s will cost me more.

namespace System.Linq{} is clearly shorter than using System;using System.Linq; just by looking at it. The idea is to omit both usings completely.

Ahh yes it removes both, you're right, I was thinking it only removed the one. Thanks.

If you use ToLookup instead of GroupBy, you can use the Count property instead of the method.
Also Char.IsUpper(c.Key) should be a bit shorter, although in case of 'unicode letters' it will include those too, like À.

And there is a Console.Write that takes a char[]. So you can use ToArray instead of ToList and cut the ForEach.

And of course .OrderBy(c => -c.Count) instead of OrderByDescending

Only think I'm able to get working is the OrderBy :( will work on it more at home.

ToLookup is not giving me what I want, I'm not able to get that Count you mentioned, only the key. Ordering by the key just puts it in alphabetical order and that's all I'm able to do it seems. ToArray is giving me an array of IGrouping. :(

PHP - 105 bytes
<?preg_filter(~‹§æ“Ö¢‹ö,'$f[$0&ﬂ]++',join('',range(a,z)).$argv[1]);arsort($f);foreach($f as$l=>$F)echo$l;

Here's a hexdump, cause of the special characters:
0000000 3c 3f 70 72 65 67 5f 66 69 6c 74 65 72 28 7e dc
0000010 a4 be d2 85 a2 dc 9a 2c 27 24 66 5b 24 30 26 df
0000020 5d 2b 2b 27 2c 6a 6f 69 6e 28 27 27 2c 72 61 6e
0000030 67 65 28 61 2c 7a 29 29 2e 24 61 72 67 76 5b 31
0000040 5d 29 3b 61 72 73 6f 72 74 28 24 66 29 3b 66 6f
0000050 72 65 61 63 68 28 24 66 20 61 73 24 6c 3d 3e 24
0000060 46 29 65 63 68 6f 24 6c 3b
0000069

And a slightly less golfed version:
<?
preg_filter(           // regular expression
  "#[A-z]#e",          // matches every letter + 'eval' flag
  '$f[$0&ﬂ]++',        // so this code runs for every letter
                       // $f is an array whose indices are uppercase letters
                       //   and whose values represent the number of occurences
                       // lowercase is converted to uc with the bitwise and
                       //   ﬂ is 11011111 in binary, every bit except for 32's is set
  join('', range(a,z)) // adding abcdefghijklmnopqrstuvwxyz to the input
    .$argv[1]);        //   because not all letters have to appear in the input
arsort($f);            // sort $f in reverse, maintaining indices
foreach($f as$l=>$F)   //
  echo$l;              // print each index in order

Example:
 $ php etaoin_shrdlu.php "This function sorts an array such that array indices maintain their correlation with the array elements they are associated with."
 ATIRESHNOCYUWMDLFXZBVGPQKJ

How do the special characters in preg_filter() work?

In PHP ~ is the bitwise NOT operator, and you can apply it to strings as well, in which case it works on every character. Furthermore, PHP is happy to parse strings of text as string literals given that there are no special characters in them (e.g. operators, $ for variables, semicolon, parantheses ...). So, writing ~‹§æ“Ö¢‹ö (the bitwise inverted version) instead of "#[A-z]#e" saves one byte, as it does not have to be quoted.

Ah, thanks. Makes sense now.

Insofar as anything in PHP makes sense. Holy moly.

echo join(array_keys($f)); can save one byte

C# in LINQPad - 203 Bytes
I took a different approach to the answer of Logan Dam. I made sure first that every character in the input string is sorted by its appearance and only exists once in the output string. After that I added every missing character from the alphabet to the output string.

void e(string i){var a="";foreach(var d in i.ToUpper().GroupBy(x=>x).OrderByDescending(u=>u.Count()))if(d.Key<91&&d.Key>64){a+=d.Key;}for(int x=65;x<91;x++)if(!a.Contains((char)x)){a+=(char)x;}a.Dump();}

Sadly it wouldn't beat Logan Dam's answer if I would have made in Visual Studio.
More readable version:

void e(string i)
    {
        var a = "";
        foreach (var d in i.ToUpper().GroupBy(x => x).OrderByDescending(u => u.Count()))
        {
            if (d.Key < 91 && d.Key > 64)
            {
                a += d.Key;
            }
        }
        for (int x = 65; x < 91; x++)
        {
            if (!a.Contains((char)x))
            {
                a += (char)x;
            }
        }
        a.Dump();
    }

Yay, more LINQ love! :D

J - 38 35 char
A function taking input on the right as a string. Not a winner, but it was fun to write.
(u:65+i.26)([\:[#/.~@,e.~#])toupper

Explained:

toupper is a verb in the standard library that upcases a string. That then becomes the right argument of the verb, while the left argument is the alphabet: ASCII codepoints 65 to 90.
[ and ,e.~#]) selects (#) those letters in the right arg (]) that are elements of (e.~) the left, and then prepends (,) the left arg ([). To wit, we keep only the uppercase chars, and add a single copy of the alphabet to the end, to make sure we catch them all.
#/.~@ then gives the frequencies of each character. It so happens that this is given in alphabetical order, so right afterwards we can downsort (\:) the alphabet (the left argument [).

A quick lazy example below. Feel free to try it for yourself at tryj.tk.
   (u:65+i.26)([\:[#/.~@,e.~#])toupper '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

VBScript 157 156 bytes
Edit: changed msgbox(p) to msgbox p
More readable:
s=ucase(InputBox(z))    'z is empty.
L=len(s)
Dim a(255)
for i=1to L
    x=asc(mid(s,i))
    a(x)=a(x)+1
next
for t=0to L
    For i=65To 90
        If a(i)=t then p=chr(i)&p
    next
next
msgbox p

Golfed: (155 characters + 1 carriage return)
s=ucase(InputBox(z)):L=len(s):Dim a(255):for i=1to L:x=asc(mid(s,i)):a(x)=a(x)+1:next:for t=0to L:For i=65To 90:If a(i)=t then p=chr(i)&p
next:next:msgbox p

I had it at 171 earlier with code that I found more interesting, but comfortablydrei's sorting method is shorter and requires len(s), which makes a "for" shorter than the "while" for the first loop. (yawn)
's=UCase(InputBox(Z))&8 'just need any extra character.  0-7 don't work because &7 is octal

s=UCase(InputBox(Z)) 'nevermind
Dim a(999)
While Len(s)
    x=Asc(s) 'returns ascii of first char
    a(x)=a(x)-1 'going negative saves a character later...
    s=Mid(s,2) 'doesn't care if you run out of string
Wend
for j=1 to 26 'this used to be   While Len(p)<26
    For i=65To 90
        If a(i)<a(y) Then y=i 'it is barely not worth it to do a(i)+a(i+32)>a(y) here to skip the ucase() above
    Next
    p=p&Chr(y)
    a(y)=1 'if I didn't go negative this would have to be -1.  arrays default to 0.
Next
MsgBox(p)

I learned some cool tricks from this post! Thanks for the mention, too. One thing: I think for t=0 should be for t=1, otherwise you always print the whole alphabet.

@comfortablydrei Printing the whole alphabet is required.
"The program/function must output only the 26 UPPERCASE letters of the English alphabet, including those that do not appear in the input"

whoa. missed that one. then it's my mistake. thanks!

C++ 701  322  232 bytes
First version 701 bytes (idiomatic STL usage)
#define _HAS_TRADITIONAL_STL 1
#include <numeric>
#include <iostream>
#include <iterator>
#include <string>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#define ALL(x) x.begin(), x.end()
using namespace std;
typedef istream_iterator<char> iic;typedef pair<int, char> pic;map<char, int> c;set<pic> d;
void f1(char x) {c[x]--;}
void f2(const pic &p) {d.insert(make_pair(p.second, p.first));}
int main(){string s(26, 0);stdext::iota(ALL(s), 65);copy(ALL(s), ostream_iterator<char>(cout));transform(iic(cin), iic(), back_inserter(s), toupper);for_each(ALL(s), f1);for_each(ALL(c), f2);transform(ALL(c2), ostream_iterator<char>(cout), select2nd<pic>());}

Expanded clean version :
#define _HAS_TRADITIONAL_STL 1
#include <numeric>
#include <iostream>
#include <iterator>
#include <string>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
using namespace std;

typedef istream_iterator<char> iic;
map<char, int> counts;
set<pair<int, char> > counts2;

void docount(char ch) { counts[ch]--; }
void toCounts2(const pair<char, int> &p) { counts2.insert(make_pair(p.second, p.first)); }

int main()
{
    string s(26, 0);
    stdext::iota(s.begin(), s.end(), 65);
    transform(iic(cin), iic(), back_inserter(s), toupper);
    for_each(s.begin(), s.end(), docount);
    for_each(counts.begin(), counts.end(), toCounts2);
    transform(counts2.begin(), counts2.end(), ostream_iterator<char>(cout), select2nd< pair<int, char> >());
}

The idea is to demonstrate a "proper" C++ program without any hacks.
Ignore the boilerplate and the fact that this only compiles on VC++
Explanation :
We fill A to Z into a string with iota(), this ensures that when we count the occurrences, each character appears even if it's not in the input.
transform() copies character by character from standard input and puts it into the end of s after calling toupper() on each one
The count of each character is decremented in the map (by maintaining negative counts we can have descending sort without extra code)
The counts map entries are copied to a set of pairs, swapping (char, count) to (count, char). Since sets are ordered, we get them sorted by decreasing frequency count
Finally we copy the set's content to standard out, using transform, and using select2nd() to pick out only the second member of the pair.
The code is fairly readable. A C++11 solution would look much prettier, since we can use lambdas
C++11 version - no need of lambdas, but auto and range based for makes things very clean (come to think of it you can do very similar with regular C++98)
#include<iostream>
#include<iterator>
#include<map>
#include<set>
using namespace std;int main(){istream_iterator<char> b(cin),e;map<char,int> c;set<pair<int,char>> d;for(char i='A';i<='Z';++i){--c[i];}for(auto i=b;i!=e;++i){c[toupper(*i)]--;}for(auto p:c){d.insert(make_pair(p.second,p.first));}for(auto p:d){cout<<p.second;}}

Expanded version :
#include <iostream>
#include <iterator>
#include <map>
#include <set>
using namespace std;
int main()
{
    istream_iterator<char> b(cin), e;
    map<char, int> c;
    set<pair<int, char>> d;
    for(char i = 'A'; i <= 'Z'; ++i) {--c[i];}
    for(auto i = b; i != e; ++i) {c[toupper(*i)]--;}
    for(auto p : c) { d.insert(make_pair(p.second, p.first)); }
    for(auto p : d) { cout << p.second; }
}

Next iteration (why read from stdin when we have argv):
#include <set>
#include <iostream>
int c[256];int main(int n, char **s){std::set<std::pair<int,char>> d;while(*s[1]){c[toupper(*s[1]++)]--;}for(n=65;n<92;++n){d.insert(std::make_pair(--c[n],n));}for(auto p:d){std::cout<<p.second;}}

Expanded version:
#include <set>
#include <iostream>
int c[256];
int main(int n, char **s)
{
    std::set<std::pair<int, char>> d;
    while (*s[1])
    {
        c[toupper(*s[1]++)]--;
    }
    for (n = 65; n < 92; n++)
    {
        d.insert(std::make_pair(--c[n], n));
    }
    for (auto p : d)
    {
        std::cout << p.second;
    }
}

APL, 26 20 characters
⎕a[⍒+/⎕a∘.=('\w'⎕r'\u0')⍞]
⎕a[⍒+/⎕a∘.=1(819⌶)⍞]
-6 thanks to Adam.

('\w'⎕r'\u0') → 1(819⌶)

C++ 377
Implements qsort using letter counts in array n to sort alphabet in array A.
Run via command line: golf.exe < in.txt
int n[26],c,k,N;
char A[26];
int C(const void*a,const void*b)
{
int i=(int)(*(char*)a -'A');
int j=(int)(*(char*)b -'A');
return n[j]-n[i];
}
int main()
{
for(;k<26;k++)
{
A[k]=k+'A';
}
N=sizeof(A);
c=getchar();
while(c>0)
{
c=toupper(c);
c=c-'A';
if(c>=0&&c<26)n[c]++;
c=getchar();
}
qsort(A,N,1,C);
for(k=0;k<N;k++)
{
putchar(A[k]);
}
return 0;
}

173 bytes

C, 117(119) bytes
x[256];m=1;char c;main(){while(c=getchar()+1)++x[c-1&95];for(;m=x[++c]<x[m]?m:c;x[m<65|m>90||c?m*!c:putchar(m)]=-1);}

Some inputs containing ASCII codes >= 128 will incorrectly increase letter frequencies.  To fix this, replace the constant 95 with 223, at a cost of 1 extra byte.
This will terminate early on inputs containing the character with ASCII code 255.  To fix this at the cost of 1 extra byte, change char c; to just c; and ++c to c=c+1%255.

PowerShell  - 139 chars
First, I'm not an PowerShell expert. Pretty sure there are shorter than this. But was happy with it and decided to share.
$a = Read-host
$b = ($a.ToUpper() -replace '[^A-Z]','').ToCharArray() + (65..90|%{[char[]]$_})|Group|sort Count -desc|%{$_.Name}
-join $b

How it works:
$a = Read-host            # read from stdin and save into a string var $a
$a.ToUpper()              # Convert the string to UPPERCASE
-replace'[^A-Z]',''       # Remove all non A-Z characters from the str
(...).ToCharArray()       # Convert the inner object (string) to a Char Array
+  (65..90|%{[char[]]$_}) # Create another char array with A-Z chars expanded,
                          #  and append it to the previous one.
|Group                    # Group the char array by value for each element,
                          #  consolidates them and count each char occurrence. Example:
                          #  Count | Name
                          #  ----- | -----
                          #      4 | B
                          #      1 | F
                          #      2 | C
                          #     .. | ..
                          #
|sort Count -desc         # Sorts the previous hash-table by the 'Count' column
                          #   in desc ordering
|%{$_.Name}               # Grab only the 'Name' column from the previous sorted hash-table.
                          # The retuslt obj will be a simple char array again,
                          #   with the letters in the desired order
$b = (...)                # Saves the resulting char array into a new variable $b
-join $b                  # join the resulting char array elements into a single
                          #   string, and print it to stdout.

Ceylon,  98 bytes
String f(String s)=>String(('A':26).sort(byDecreasing((Object c)=>s.uppercased.count(c.equals))));

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

System.out.printf("%c",l+65) saves a few bytes.

@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!

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;}

154 bytes (including @Nevay's changes). Using a char[], as usual ;-)

139 bytes assuming ASCII input (changed length of a to 96 and -=(65-c&c-91)>>-1 to ++).

-1 byte: c&~32 instead of c&=~32.

@Nevay My mistake, I didn't review enough ;-)

Japt, 8 bytes
;Bñ@kX l

Try it
;Bñ@kX l     :Implicit input of string U
;B           :Uppercase alphabet
  ñ          :Sort by
   @         :Passing each X through the following function
    kX       :  Case-insensitively remove all occurences of X from U
       l     :  Length

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)
  }

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

And one more character by def f(...)=print(...) instead of def f(...){print(...)}

@DanGetz thanks for your suggestions, i implemented it ! I have not added "=" since I m not returning anything, i m printing in func itself.

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.

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.

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

Retina, 81 75 bytes
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

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

Vyxal, 8 bytes
kAµ?⇧nO⌐

Try it Online!
kA       # Uppercase alphabet
  µ    ⌐ # Reverse sorted by...
      O  # Count of...
     n   # This item in...
   ?⇧    # Uppercase input

BQN, 24 bytes
{'A'+⍒+˝(⥊-⌜"aA")=⌜↕26}

A tacit function that accepts a single argument.
-8 from ovs.

(⥊-⌜"aA")=⌜↕26 from this answer might be helpful.

awesome, -8 bytes

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

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!)

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}

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);

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.

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

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 ;

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.

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.

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

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.

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.

05AB1E, 9 bytes
lAΣ¢}ÙRáu

Try it online!

More interesting 10-byte version:
05AB1E, 10 bytes
l{γéJAìÚRá

Try it online!

Burlesque, 12 bytes
ZZ:rdf:q[~\m

Try it online!
ZZ  # To caps
:rd # Filter for alpha
f:  # Frequency list (zipped count, char, sorted by frequency)
q[~ # Take tails (char)
\m  # Map-concat

Perl 5 -n0, 41 bytes
for$x(A..Z){$;[pos=-split/$x/i].=$x};say@

Try it online!

Thunno 2, 8 bytes
kAÞ$RncṄ

Try it online!
Explanation
kAÞ$RncṄ  # Implicit input
kA        # Uppercase alphabet
  Þ    Ṅ  # Reverse-sorted by:
   $R     #  Uppercase input
     nc   #  Count occurrences
          # Implicit output

Raku, 38 bytes
{[~] ('A'..'Z').sort:{-.uc.comb($^x)}}

Try it online!

('A' .. 'Z').sort: { ... } sorts the capital letters by whatever the brace-delimited anonymous subroutine returns for each.
.uc converts the input string to uppercase.
.comb($^x) counts how many times the character $^x (the implicit argument to the function) appears in the uppercased input string.
- returns the negative of the character count, so the letters are sorted in order of decreasing frequency.
[~] joins the sorted letters into a single string.

Nibbles, 8 bytes (16 nibbles)
+=~|_\$u,+%.@`)$

+=~|_\$u,+%.@`)$        # full program
+=~|_\$u,+%.@`)$$       # with implicit arg added;
   |                    # filter
    _                   # printable characters
                        # (default value for _ when no STDIN)
                        # by
     \$u                #   is it an uppercase character?
 =~                     # now split these letters into groups, sorted by:
        ,               #   length
         +              #   (after flattening)
          $     $       #   of using this letter to split
            @           #   input
           .            #   mapped
             `)$        #     to uppercase
+                       # and finally flatten the sorted groups

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Racketeer Taxi Driver
The Scenario
You are a taxi driver in your city. You picked up a passenger from the airport and he told you the place he'd like to go.
To earn more money, you need to drive as much as you can. However, there are two problems:

He always looks around. Therefore, you cannot pass from the same district twice.
The passenger is not so dumb. He knows the shortest way between the airport and the destination. Therefore, while you're driving, you should pass each of those districts.

The Input
Input is an undirected and edge weighted graph. The vertices are the districts and the edges are the ways that connect those districts. The weights of the edges indicate the distance between the districts. You can model the graph any way you want.
The Output
Given the source and destination, among with the shortest path, find the longest path that contains each vertex in the shortest path.
The Example

WHOOPS there are two different edge weights between B and C.
Source: A
Destination: K
Shortest Path: A-D-F-I-K
Solution: A-B-C-D-E-F-G-H-I-J-K
Rules

Your solution should be generic and can be applicable to all kinds of connected graphs.
No cycles are allowed. You can pass through a vertex only once
Brute-force is not allowed. Don't list all the possibilities and pick among them.
The edge weights are always positive.
It is a must to visit all vertices in the shortest path, however, the order is not important.

Duration: 1 week.
Tie breaker: Votes.
The code with the least run-time complexity (in terms of Big-O notation) wins!

Clarification: Do we have to go through the shortest-path nodes in the correct order? Also, are edge weights guaranteed positive?

I'm pretty sure finding the optimal solution is NP-complete for the same reason Longest Path is. Just reduce from Hamiltonian Path. So, any algorithm is going to be exponential. Moreover, since the reduction doesn't require any blowup, no algorithm can be faster than one for Hamiltonian path, for which the best deterministic algorithm I'm aware of is O(n^2 2^n)

On several edges in your example you gave more than one weight, e.g. B-C has weights 5 and/or 3 without an additional vertex between.

@xnor is that a problem?

What is the tie breaker if two solutions have the same complexity?

@mbuettner clearly, votes

@cagirici "clearly"? No, that is by no means implied by any of the tags you used. Neither is it a common default tie-breaker employed on PPCG. If you want to use votes as the tie breaker, you should specify that in the challenge.

@cagirici If a brute force solution is optimal, that is, if O(n!) is the minimum runtime, is it allowed? Or do you know there is a better solution?

@m.buettner NP completeness isn't necessarily a problem, but it pushes the competition into the exponential time and limits the possibility of an algorithm significantly better than brute force, which I find less interesting, but YMMV. It also increases the odds that the brute force O(n!) is the best you can do.

Reduction to Traveling Salesman Problem, O(n^2*2^n).
In the above, n is the number of vertices in the graph.
I will give a description of the algorithm for now. Starting with the input graph, carry out the following steps:

Create a new graph with edge weights equal to the negation of the input edge weights. These weights represent the value to the taxi driver of traversing those edges.
Let N be the sum of all of the negative weights in the (new) graph minus 1. Add N to each outgoing edge from a node on the shortest path (as given in the input). This represents the fact that the taxi driver absolutely must cross each vertex in the shortest path.
Now, use dynamic programming to solve the traveling salesman problem on this new graph as follows:
Next, create a memo table, m, with entries that are pairs, (v,S), where v is the final vertex in the (partial) path created so far, and S is a subset of the vertices in the graph. The weight associated with this entry will be the minimum sum of edge weights to reach v after having passed through the vertices in S. Also, maintain a parent pointer.
Initialize the memo table with the entry m[(source,{source}]=0, p[(source,{source}]=None.
Fill in the memo table, using the recursion that m[(v,S)] = min(m[(u,S-{v})]+w[(u,v)] for u in S), where w is the the edge weight dictionary. Create parent pointers accordingly.
Using the completed memo table, find the minimum value of m[(destination,S)], for all subsets S of the input vertices.
Trace the parent pointers from this minimum value backwards until we reach the source node. The resulting path is the solution.

I don't feel like coding that all up, but I believe it is a correct solution. It runs in O(n^2*2^n) time because there are n*2^n entries in the memo table, and each is generated by taking a minimum over no more than n possibilities. All the other work takes far less than that amount of time.
This solves the problem because the traveling salesman path must go through all of the vertices on the shortest path, because skipping one of those vertices results in an increase in the traveling salesman cost of N, which cannot be offset by the negative edge weights in the graph, since N was chosen to be more negative than all of them combined.