Solved LengthOfLastWord in java