Bug in the input


Plz mention in the problem statement that there is possibility of whitespaces at the end of string. Wasted 40 minutes to find out that the string has to be preprocessed to remove whitespaces at the end. Solution code isn’t considering it too. Might be a bug or an incomplete problem statement.