Who's gonna win the football game? The American football championship, Super Bowl 50, is happening today at 11:30pm UTC (and you can watch it live online). This challenge was made to celebrate it.



In an American football game, two teams compete to get the most points and there are six ways to score these points. We'll give each an abbreviation:


Field goal - FG: 3 points
Touchdown - TD: 6 points
Extra point - XP: 1 point - Can only be scored directly after a touchdown.
Two-point conversion - XD (like an extra point but happier): 2 points - Can only be scored directly after a touchdown.
Safety - S: 2 points
Fair catch kick - FCK: 3 points (a very rare play)


Write a program or function that takes in a single line string containing only these six abbreviations, in both uppercase and lowercase.

This string represents all the scoring events in a game (or portion of a game) of football, with the uppercase terms belonging to one team and the lowercase belonging to the other.

Your job is to report the final scores of the game and indicate who won with output of the form

[score 1] [to] [score 2]


where:


[score 1] is always the larger of the two scores (if not equal), regardless of if uppercase or lowercase won.
[score 2] is the smaller of the two scores (if not equal).
[to] is TO if the uppercase team won, to if the lowercase team won, and To if it's a tie.



  Example: All the scoring events in Super Bowl XLIX
  could be summarized by the string

TDXPtdxpTDXPtdxpfgtdxpTDXPTDXP

  
  where uppercase is the New England Patriots and lowercase is the
  Seattle Seahawks. The Patriots scored 28 and the Hawks 24, so
  the output would be:

28 TO 24



Notes


Your program/function must support any arbitrary input, including the empty string.
XP and XD will only occur right after TD. xp and xd will only occur right after td.
You may not assume the input string starts or ends in a certain case.
A single trailing newline is optionally allowed in both the input and output


Scoring

The shortest code in bytes wins. Answers that are posted before the kickoff (too late now!) of Super Bowl 50 may predict the winning team (either Panthers or Broncos), and if they are correct, get a -10% byte bonus!

(I will check revision history to ensure predictions have not changed and really were made before kickoff.)

Test Cases

[empty string] -> 0 To 0
TDXPtdxpTDXPtdxpfgtdxpTDXPTDXP -> 28 TO 24
FG -> 3 TO 0
fg -> 3 to 0
TD -> 6 TO 0
td -> 6 to 0
TDXP -> 7 TO 0
tdxp -> 7 to 0
TDXD -> 8 TO 0
tdxd -> 8 to 0
S -> 2 TO 0
s -> 2 to 0
FCK -> 3 TO 0
fck -> 3 to 0
TDTDXDSssFCKfgfckFGtd -> 22 TO 16
fcksFCKS -> 5 To 5
tdtdtdtdxp -> 25 to 0
SSSSSSSTD -> 20 TO 0
fgSfckFGfgtdxptdxdTDs -> 26 to 11
FGTDXPtdxdtdsStdxpfgTDfckTDXDFCK -> 29 To 29
MATL, 51*0.9 = 45.9 54 57 58 63 bytes

Thanks to Dennis for removing 3 bytes!

'%i To %i'j0h!3'PDFTS'tkXc=s4:Hh*sSPYD3MdXK?kK0&lt;?Xk


An empty input string is represented in the online compiler as a single newline character.

EDIT (June 8, 2016): The link below includes a modification as per release 18.1.0 of the language (move he first 3 right before Xc)

Try it online!

I bet on the Broncos.

Explanation

The scores are detected using a single letter, either upper or lowercase (uppercase is shown in the following): 


P for XP (1 point)
D for XD (2 points)
F for FG (3 points) and for FCK (3 points)
T for TD (6 points)
S for S (2 points)


Each of these five letters corresponds uniquely to a score event except that


F is reused for FG and FCK, which have the same score. Thanks to @Dennis for this!
D will detect both TD and XD. So T will be assigned 4 points instead of 6 to compensate.


The ordering PDFTS, saves a few bytes when defining the number array that specifies the points: [1,2,3,4,2].

Each event is detected by the presence of one of the above letters in uppercase or lowercase. The comparison is done in three dimensions: input string length (N) × number of teams (2) × number of detected score events (5). Extensive use is made of broadcasting, which is the automatic expansion of an array along a singleton dimension to match the size of a larger array.

'%i To %i'  % string with format specifiers for two integers
j0h         % input string. Attach 0 so it's never empty. Gives string of length N&gt;0
!           % transpose into char array of size N×1
3           % number literal
'PDFTS'     % characters to detect the five combined types of score
tk          % duplicate and convert to lowercase
Xc          % concatenate along the third dimension to produce a 1×5×2 array
=           % test for equality with broadcast. Gives N×5×2 array
s           % sum along 1st dim. Gives 1×5×2 array
4:Hh        % array [1,2,3,4,2] to compute the total score. Size 1×5(×1) 
*           % multiply with broadcast. Gives 1×5×2 array
s           % sum along 2nd dim. Gives 1×1×2 array with the two scores
SP          % sort in reverse order along 3rd dim
YD          % sprintf. Gives output string with "To"
3M          % push array with the two scores again
dXK         % difference along 3rd dim. Gives a number. Copy to clipboard K
?           % is it non-zero? If so we need to make either lowercase or uppercase
  k         %   make (tentatively) lowercase
  K0&lt;       %   did the uppercase team win?
  ?         %   if so...
    Xk      %     make uppercase
            % implicitly end the two if's and display string