Extract canMakeWord function