If you win the first heart trick and immediately attack diamonds, the defense will win the ♦A and continue with hearts. You’ll have eight tricks only at that point: the ♠A K, the ♥A K, three diamonds and the ♣A. If the club finesse doesn’t work, the contract will fail.
Is there a better way? Yes. Win the first trick in dummy and immediately take the club finesse. If it works, forget about repeating the finesse and go after diamonds. (If West ducked the ♣K at trick two, he’ll be sorry.) If the club finesse fails, however, win the heart return and work on diamonds.
Won’t the opponents run the heart suit? That depends. If West has the ♦A, yes, you’ll finish down three. If
East has the ♦A, however, he may have no more hearts to play. In that case, you can win any return and claim with overtricks.
There is no 100% line of play, but tackling the clubs and diamonds in the proper order gives you the best chance. You will go down only when West has both the ♣K and the ♦A.
The full deal: