Identify halves of Poker cards A casino uses the following deck of cards. (* is one of the card suits D, S, C or H.)

 _________    _________    _________    _________    _________
|         |  |         |  |         |  |         |  |         |
|         |  |         |  |    *    |  |  *   *  |  |  *   *  |
|         |  |    *    |  |         |  |         |  |         |
|    *    |  |         |  |    *    |  |         |  |    *    |
|         |  |    *    |  |         |  |         |  |         |
|         |  |         |  |    *    |  |  *   *  |  |  *   *  |
|_________|  |_________|  |_________|  |_________|  |_________|

 _________    _________    _________    _________    _________
|         |  |         |  |         |  |         |  |         |
|  *   *  |  |  *   *  |  |  *   *  |  |  *   *  |  |  *   *  |
|         |  |         |  |  *   *  |  |  *   *  |  |  *   *  |
|  *   *  |  |  * * *  |  |         |  |    *    |  |  *   *  |
|         |  |         |  |  *   *  |  |  *   *  |  |  *   *  |
|  *   *  |  |  *   *  |  |  *   *  |  |  *   *  |  |  *   *  |
|_________|  |_________|  |_________|  |_________|  |_________|

 _________    _________    _________
|         |  |         |  |         |
|  *   *  |  |  *   *  |  |  * * *  |
|  *   *  |  |  * * *  |  |  *   *  |
|  * * *  |  |  *   *  |  |  * * *  |
|  *   *  |  |  * * *  |  |  *   *  |
|  *   *  |  |  *   *  |  |  * * *  |
|_________|  |_________|  |_________|


After each night, old decks are discarded, and cut in half to avoid reuse.
As a result, the casino has a big room full of cut card halves.

Unfortunately the economy is bad, and the casino is in financial trouble. The most 
reasonable thing to save money seems to be recycling, so the casino owners decide to tape old cards back together. So they hire a team to build a machine which will do this. 

You are part of the team, and your job is to help identifying the card.

Write a program or function which will take an ASCII art image of a card half in the form of a string, and will return a string of what card it is.

Input is an 11x5 string, plus line break characters (CR, LF or CRLF, you only need to support one). You may assume trailing whitespace at the end of each input line, if necessary. The input won't contain any invalid characters (any other than _|-HSCD and space and line break).

A card half will look like this:

 _________
|         |
|  H   H  |
|  H H H  |
---H---H---


which should be identified as the Queen of Hearts:

H12


The casino is on a limited budget, so this is code golf: the shortest program wins.
CJam, 16 15 13 12 bytes

q2*A~&lt;$e`3=(


Test it here.

Explanation

The basic idea is to manipulate the string such that we can make CJam's built-in run-length encoding work for us.

Let's go through an example (the one from the question). The input string is

 _________
|         |
|  H   H  |
|  H H H  |
---H---H---


We repeat that twice:

 _________
|         |
|  H   H  |
|  H H H  |
---H---H---
 _________
|         |
|  H   H  |
|  H H H  |
---H---H---


And remove the last line:

 _________
|         |
|  H   H  |
|  H H H  |
---H---H---
 _________
|         |
|  H   H  |
|  H H H  |


Then we sort this string. It'll now have a bunch of newlines at the start, and then this (shortened by a few spaces to avoid a horizontal scrollbar):

                                    ---------HHHHHHHHHHHH__________________||||||||||||


While the suit character will vary, it'll always be an upper case letter, found in the fourth run of the sorted string (accounting for the newline). When we run-length encode this we get

[8 '\n] [46 ' ] [9 '-] [12 'H] [18 '_] [12 '|]]


So all we need to do is pick out the fourth  element and reverse it.

Here is a breakdown of the actual code:

q              e# Read the input.
 2*            e# Repeat twice.
   A~&lt;         e# Remove the last 11 characters, i.e. the last line.
      $        e# Flatten into a single string and sort its characters.
       e`      e# Run-length encode: turns the sorted string into 5 pairs of numbers
               e# and characters.
         3=    e# Select the one corresponding to the suit.
           (   e# Pull off the number so that its printed after the suit.