The longest play is Hamlet , which is the only Shakespeare play with more than thirty thousand words , and the shortest is The Comedy of Errors , which is the only play with fewer than fifteen thousand words .