We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
In my opinion, either the problem statement is ambigous or it is inconsistent with the test cases.
Being an excercise to introduce the metacharacters \S and \s, the resolution should be simple and straightfoward, that is /^\S\S\s\S\S\s\S\S$/
However that expression does not pass some of the test cases. Namely those with multiple whitespaces or non-whitespaces. Thus the solution should be /^\S\S+\s+\S\S+\s+\S\S+$/ which also do not work. So said!!
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Matching Whitespace & Non-Whitespace Character
You are viewing a single comment's thread. Return to all comments →
In my opinion, either the problem statement is ambigous or it is inconsistent with the test cases.
Being an excercise to introduce the metacharacters \S and \s, the resolution should be simple and straightfoward, that is /^\S\S\s\S\S\s\S\S$/
However that expression does not pass some of the test cases. Namely those with multiple whitespaces or non-whitespaces. Thus the solution should be /^\S\S+\s+\S\S+\s+\S\S+$/ which also do not work. So said!!