saved 1 byte
Source Link
Arnauld
  • 161.7k
  • 15
  • 159
  • 574

#JavaScript (ES6), 36 2828 27 bytes

Saved 1 byte by inverting the result, as suggested by LarsW

Takes input in lowercase. Returns false for a booleanstrong word and true for a non-strong word.

s=>!/[^aeiouy]{2}/.test(s+0)

###How?

We append a 0 (non-vowel) at the end of the input string and look for two consecutive non-vowel characters. This allows us to cover both cases that make a word not strong:

  • it contains two consecutive consonants
  • or it ends with a consonant

###Test cases

let f =

s=>!/[^aeiouy]{2}/.test(s+0)

;[
  "hate", "love", "popularize", "academy", "you", "mouse", "a", "euouae",
  "acorn", "nut", "ah", "strong", "false", "parakeet"
]
.forEach(s => console.log(s + ' --> ' + f(s)))

#JavaScript (ES6), 36 28 bytes

Returns a boolean.

s=>!/[^aeiouy]{2}/.test(s+0)

###How?

We append a 0 (non-vowel) at the end of the input string and look for two consecutive non-vowel characters. This allows us to cover both cases that make a word not strong:

  • it contains two consecutive consonants
  • or it ends with a consonant

###Test cases

let f =

s=>!/[^aeiouy]{2}/.test(s+0)

;[
  "hate", "love", "popularize", "academy", "you", "mouse", "a", "euouae",
  "acorn", "nut", "ah", "strong", "false", "parakeet"
]
.forEach(s => console.log(s + ' --> ' + f(s)))

#JavaScript (ES6), 36 28 27 bytes

Saved 1 byte by inverting the result, as suggested by LarsW

Takes input in lowercase. Returns false for a strong word and true for a non-strong word.

s=>/[^aeiouy]{2}/.test(s+0)

###How?

We append a 0 (non-vowel) at the end of the input string and look for two consecutive non-vowel characters. This allows us to cover both cases that make a word not strong:

  • it contains two consecutive consonants
  • or it ends with a consonant

###Test cases

let f =

s=>/[^aeiouy]{2}/.test(s+0)

;[
  "hate", "love", "popularize", "academy", "you", "mouse", "a", "euouae",
  "acorn", "nut", "ah", "strong", "false", "parakeet"
]
.forEach(s => console.log(s + ' --> ' + f(s)))

added the 'How?' section
Source Link
Arnauld
  • 161.7k
  • 15
  • 159
  • 574

#JavaScript (ES6), 36 28 bytes

Returns a boolean.

s=>!/[^aeiouy]{2}/.test(s+0)

###How?

We append a 0 (non-vowel) at the end of the input string and look for two consecutive non-vowel characters. This allows us to cover both cases that make a word not strong:

  • it contains two consecutive consonants
  • or it ends with a consonant

###Test cases

let f =

s=>!/[^aeiouy]{2}/.test(s+0)

;[
  "hate", "love", "popularize", "academy", "you", "mouse", "a", "euouae",
  "acorn", "nut", "ah", "strong", "false", "parakeet"
]
.forEach(s => console.log(s + ' --> ' + f(s)))

#JavaScript (ES6), 36 28 bytes

Returns a boolean.

s=>!/[^aeiouy]{2}/.test(s+0)

###Test cases

let f =

s=>!/[^aeiouy]{2}/.test(s+0)

;[
  "hate", "love", "popularize", "academy", "you", "mouse", "a", "euouae",
  "acorn", "nut", "ah", "strong", "false", "parakeet"
]
.forEach(s => console.log(s + ' --> ' + f(s)))

#JavaScript (ES6), 36 28 bytes

Returns a boolean.

s=>!/[^aeiouy]{2}/.test(s+0)

###How?

We append a 0 (non-vowel) at the end of the input string and look for two consecutive non-vowel characters. This allows us to cover both cases that make a word not strong:

  • it contains two consecutive consonants
  • or it ends with a consonant

###Test cases

let f =

s=>!/[^aeiouy]{2}/.test(s+0)

;[
  "hate", "love", "popularize", "academy", "you", "mouse", "a", "euouae",
  "acorn", "nut", "ah", "strong", "false", "parakeet"
]
.forEach(s => console.log(s + ' --> ' + f(s)))

saved 8 bytes
Source Link
Arnauld
  • 161.7k
  • 15
  • 159
  • 574

#JavaScript (ES6), 3636 28 bytes

Returns a boolean.

s=>!/[^aeiouy]([^aeiouy]|$){2}/.test(ss+0)

###Test cases

let f =

s=>!/[^aeiouy]([^aeiouy]|$){2}/.test(ss+0)

;[
  "hate", "love", "popularize", "academy", "you", "mouse", "a", "euouae",
  "acorn", "nut", "ah", "strong", "false", "parakeet"
]
.forEach(s => console.log(s + ' --> ' + f(s)))

#JavaScript (ES6), 36 bytes

Returns a boolean.

s=>!/[^aeiouy]([^aeiouy]|$)/.test(s)

###Test cases

let f =

s=>!/[^aeiouy]([^aeiouy]|$)/.test(s)

;[
  "hate", "love", "popularize", "academy", "you", "mouse", "a", "euouae",
  "acorn", "nut", "ah", "strong", "false", "parakeet"
]
.forEach(s => console.log(s + ' --> ' + f(s)))

#JavaScript (ES6), 36 28 bytes

Returns a boolean.

s=>!/[^aeiouy]{2}/.test(s+0)

###Test cases

let f =

s=>!/[^aeiouy]{2}/.test(s+0)

;[
  "hate", "love", "popularize", "academy", "you", "mouse", "a", "euouae",
  "acorn", "nut", "ah", "strong", "false", "parakeet"
]
.forEach(s => console.log(s + ' --> ' + f(s)))

added the new test cases
Source Link
Arnauld
  • 161.7k
  • 15
  • 159
  • 574
Loading
Source Link
Arnauld
  • 161.7k
  • 15
  • 159
  • 574
Loading