Changed input.length in the if condition to inputString.length