Added user input parsing method to match all test cases