Name the poker hand - 7 cards edition
Haskell 618 603 598 525 512 504 480 464

Cards taken as a line of input. I think I've golfed this to death, but will easily be beaten by ruby etc using the same trick: if you generate all permutations, you get the forward sorts you want to look for straights, plus the reverse sorts you want for testing N of a kind.

import Data.List
m=map
z=take 5
q=m(\x-&gt;head[n|(f,n)&lt;-zip"A23456789TJQK"[1..],f==x!!0])
l=m length
v=" of a kind"
w="flush"
y="straight"
c f s p r|f&amp;&amp;r="9royal "++w|f&amp;&amp;s='8':y++" "++w|f='5':w|s||r='4':y|True=case p of 4:_-&gt;"7four"++v;3:2:_-&gt;"6full house";3:_-&gt;"3three"++v;2:2:_-&gt;"2two pair";2:_-&gt;"1one pair";_-&gt;"0high card"
d x=c([5]==l(group$m(!!1)x))(q x==z[head(q x)..])(l$group$q x)$q x==1:[10..13]
k h=tail$maximum$m(d.z)$permutations$words h
main=interact k


Edited to inline "pair" and use number prefixes after seeing @FDinoff's entry, also composed map functions to shave one more char.