recursive solution to wordbreak