Disclaimer: This isn't my challenge but ThisGuy said I was OK to post.
Occasionally I want to make a word into it's opposite, like happiness
goes to unhappiness
. Unfortunately when this happens, my brain will sometimes go blank. Then one day, after yet another this happening, I thought to my self "This is what programs are for!"
As the English language has many exceptions, I have created a list which contains the prefix for the starting letter
q or h -> dis- (honest -> dishonest)
l -> il- (legal -> illegal)
m or p -> im- (mature -> immature)
r -> ir- (responsible -> irresponsible)
everything else -> un- (worthy -> unworthy)
Task
Given an input as a string, make the string into its negative and output the result. You can assume that all the inputs given will fit the above rules. Submissions may be programs or functions, not snippets.
Input
A single string, taken either as a parameter or from STDIN
Output
The negated form of that string, conforming to the above rules
How to Win
This is a code-golf so shortest code wins
q
without au
? \$\endgroup\$qadi
,qat
, the aforementionedqi
,qirsh
, andqwerty
. (I play a lot of Scrabble) \$\endgroup\$q
is always followed by au
in the string or not? \$\endgroup\$u
\$\endgroup\$