solution to poetry problem