Why it is only 40% despite my correct method of approaching?
user171027 make sure your code works correctly if the input starts with a whitespace.