Words with Letters algorithm