28
2
Challenge
Given a single word as input, determine if the word is odd or even.
Odd and Even words
Assume the general rules:
odd + odd = even
even + odd = odd
odd + even = odd
even + even = even
In the alphabet, the odd letters are:
aeiou
And the even letters are:
bcdfghjklmnpqrstvwxyz
The same applies to capital letters (AEIOU
are odd and BCDFGHJKLMNPQRSTVWXYZ
are even).
You then 'add' each of the letters in the word together. For example, the word cats
is equivalent to:
even + odd + even + even
Which simplifies to:
odd + even
Which simplifies further to:
odd
So the word cats
is odd.
Examples
Input: trees
Output: even
Input: brush
Output: odd
Input: CAts
Output: odd
Input: Savoie
Output: even
Input: rhythm
Output: even
Rules
All input will be a single word which will only contain alphabetical characters.
If the word is odd, output a truthy value. If the word is even, output a falsey value.
Winning
The shortest code in bytes wins.
1Could you add an example of a word without any odd letters. – Hedi – 2016-09-20T18:50:11.650
@Hedi I've added one, rhythm – Beta Decay – 2016-09-20T19:37:24.807
7
Excuse you. Odd Word™ has been trademarked already by JLee. This is an unauthorized use of the term. :P
– Deusovi – 2016-09-20T20:58:10.1132This is begging for a pure regex submission – Rohan Jhunjhunwala – 2016-09-20T21:19:38.130
2Is the input guaranteed to only contain alphabetical characters? – James – 2016-09-20T23:07:12.567
@DJMcMayhem Whoops, I thought I clarified that :) – Beta Decay – 2016-09-21T06:03:17.410
The answer is no. Only numbers are odd. – still_dreaming_1 – 2016-09-21T13:11:52.720
Got a hint for everybody... The ASCII values of the vowels in question are always odd. No doubt someone will exploit that for a few bytes ;). – Magic Octopus Urn – 2016-09-21T20:46:42.237
Is it possible to arrive at the answer by simply knowing the number of odd and even characters (vowels and consonants)? – rnso – 2016-10-12T15:43:54.080