JavaScript (ES6), 8680 bytes
-6 thanks to @tsh
Inspired by Neil's method.
Expects ([a, b])
.
f=(a,b)=>b>a?f(b,a):c=>(/t[hd][dt],h/.test(a+b[b,a]=c.sort())?"spade":a)+" and "+(/[dt]dd,[dh]/.test(a+bc)?"club":b)
Commented
f = (a, b)c => // a = 1st string, b// c[] = 2ndinput stringarray
b >( a ? // if b is greater than a:
f(b/[dt], a) h/ // if a swapis a"heart" and b
: is
.test( // else:
( either "heart" or "diamond",
[b, a] = //
where a and /t[hd]/b are sorted such
// c.sort() // ifthat a is "heart" and> b is either:
.test(a + b) ? // "heart" or "diamond":
//
"spade" "spade" // use "spade" as the left output
: // else:
a // use a
) + //
" and " + // append " and "
( //
/[dt]dd,[dh]/ // if ab is either "diamond" or "heart"
and a is
.test(a + bc) ? // // andeither b"diamond" isor "diamond""heart":
"club" // use "club" as the right output
: // else:
b // use b
) //