I got the spontaneous idea of making a series of challenges of users that have helped and continue to help the PPCG community be an enjoyable place for everyone, or maybe just specifically for me. :P
If you convert Dennis's name to an array of 1
s and 0
s where each consonant is 1
and each vowel is 0
, the array is [1, 0, 1, 1, 0, 1]
, which is symmetrical. Thus, your challenge is to determine what other names are like this.
Challenge
Given an ASCII string, remove all characters that aren't letters and determine if the configuration of vowels and consonants are symmetrical. y
is not a vowel.
Please note that your program does not have to be this type of string itself.
Test Cases
Dennis -> truthy
Martin -> truthy
Martin Ender -> truthy
Alex -> falsy
Alex A. -> truthy
Doorknob -> falsy
Mego -> falsy
Reference Implementation
This Python 3 code will give the correct output given a test case. It is as ungolfed as I could make it without being ridiculous.
Python 3
s = input()
l = []
for c in s:
if c in 'AEIOUaeiou':
l.append(0)
elif c in 'BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz':
l.append(1)
print(l == list(reversed(l)), end = '')