modified Java version to leetcode_Word_Break_II.py