modified lcsDP.java