Ad
  • Custom User Avatar

    @weijin96 post code below and I'll have a look for you.

  • Custom User Avatar

    @ankitom You are receiving this error because you are casting an empty string to an integer. Your variable num doesn't get appended to and remains and empty string; therefore when you cast it to an integer, you receive an error.

    1.) If there is an empty string, you must return "1" (string) not 1 (integer). You fail for an empty string: "" -> 1 (expected "1").

    2.) If there isn't an integer at the end of the string, you have to put "1" at the end of the string. Your code receives an error because num is not appended to and you get an error. You have to add a "1" at the end of the string, since there isn't a number.

    3.) Your code fails when string="foobar00" because your code doesn't check zeros, so num has been appended to and therefore it tries to cast an empty string.

  • Default User Avatar

    Im having the same problem and i still dont understand the issue even after using print() because i dont think im casting an empty string

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution