Ad
  • Default User Avatar

    Both patterns are valid cases of identifiers in Python or C++.
    https://www.w3schools.com/python/gloss_python_variable_names.asp
    https://www.w3schools.com/cpp/cpp_variables_identifiers.asp

    It is ok for the problem to choose to make a pattern be valid or choose to explicitly make something out of scope.....

    I tested some of the other already accepted solutions. When I tested, they would return different results for the ambigious cases. I would advocate updating the decription to say these patterns are out of scope. That would remove the ambiguity and leave accepted solutions intact.

  • Default User Avatar

    I felt the problem description was ambgious on some inputs. I see that for different accepted answers which I tested locally, the accepted answers return different output when given the below ambigous input.
    It would improve the problem if the specification had a single well defined output for all valid inputs and the test cases should cover them.

    1. how are leading and trailing delimeters to be handled? "__ aaa_bbb __"
    2. how are repeated delimeters to be handled? What is the expected output of "aaa____bbbb"
  • Default User Avatar

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