Ad
  • Custom User Avatar

    Your code does not take into account the number of characters in the correct way.
    For example, if the input is ";)(" it meets the condition-> [0]==";" && [1]==")"
    but does not take into account the third character "(".
    I hope it helps.

  • Custom User Avatar

    Same thing happened to me. Reading the error message may help you.
    In my case, the error occurred when there was a "+" sign just before a number at the end of the string. Had to get around it using the "isDigit()" method.
    I hope it helps.

  • Custom User Avatar

    I think the correct answer should be "4|1". my method returns "4|1" without giving any error.
    Perhaps you are counting digits from "4" so you will have "2 digits(4 & |), but in this case the number of digits should be "0 digits".
    I hope it helps.