wes d2a2ba9e15 first commit | 4 years ago | |
---|---|---|
.. | ||
README.md | 4 years ago | |
code.cpp | 4 years ago | |
unitTest.cpp | 4 years ago |
by Helen Yu tags: strings, validation, regex
Hermione has come up with a precise formula for determining whether or not a phrase was ssspoken by a parssseltongue (a reference from the Harry Potter universe; the language of ssserpents and those who can converse with them). Each word in a sssentence must contain either: At least 2 instances of the letter "s" (i.e. must be together ss), or... Zero instanc
Hermione has come up with a precise formula for determining whether or not a phrase was ssspoken by a parssseltongue (a reference from the Harry Potter universe; the language of ssserpents and those who can converse with them).
Each word in a sssentence must contain either:
ss
), or...isParselTongue("Sshe ssselectss to eat that apple. ") ➞ true
isParselTongue("She ssselects to eat that apple. ") ➞ false
// "She" only contains one "s".
isParselTongue("Beatrice samples lemonade") ➞ false
// While "samples" has 2 instances of "s", they are not together.
isParselTongue("You ssseldom sssspeak sso boldly, ssso messmerizingly.") ➞ true
There should be no words with only one instance of the letter "s" (see example #2).