Added changes in input string interpretation, changed to handle any number of inputs, replaced the condition of detecting 0 length input