Based on this challenge, you must determine if a string is covfefey, that is, could it have been produced as output from a covfefifier?
The string will be composed of only alphabet chars (
^[A-Z]\*$ are possible schemes for input. change the regexs appropriately if using caps)
To do this, there are a few checks you must do:
Do the last four characters follow this scheme:
follows this scheme.
is this consonant at the start of the ending the voiced or voiceless version of a consonant immediately before it?
consonant pairings follow this key. find the consonant occuring before the end part consonant we had, and check whether the end part consonant is there
b: p c: g d: t f: v g: k h: h j: j k: g l: l m: m n: n p: b q: q r: r s: z t: d v: f w: w x: x z: s
does the first part of the word, the part that does not include the
([^aeiouy][aeiouy])\1, follow this regex:
That is, does it contain one group of vowels, and exactly one consonant after that vowel?
If it fulfills all these criteria, it is covfefey.
Output a truthy value if covfefey, otherwise falsy
covfefe -> truthy barber -> falsy covefefe -> falsy pressisi -> falsy preszizi -> truthy prezsisi -> truthy president covfefe -> You don't need to handle this input as it contains a space. cofvyvy -> truthy businnene -> falsy (the first part does not follow the regex)