373
86
In this challenge, you must take a string matching the regex ^[a-zA-Z]+$
or whatever is reasonable (you don't have to consider uppercase or lowercase letters if you want) (you may assume the string is long enough, and has the right structure for all the operations), and output another string, produced similarly to word at the end of a recent dadaist tweet by the POTUS ("Despite the constant negative press covfefe"
).
How to covfefify a string:
First, get the first sound group (made up terminology).
How do you do this? Well:
Find the first vowel (
y
is also a vowel)v creation
Find the first consonant after that
v creation
Remove the rest of the string
creat
That is your first sound group.
Next step:
Get the last consonant of the sound group
t
and replace it with the voiced or voiceless version. To do this, find the letter in this table. Replace with the letter given (which may be the same letter)
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
so, we get
d
Then, take the next vowel after that consonant. You can assume that this consonant is not at the end of the string. Join these two together, then repeat it twice:
didi
Concatenate this to the first sound group:
creatdidi
You're done: the string is covfefified, and you can now output it.
Test cases:
coverage: covfefe
example: exxaxa
programming: progkaka (the a is the first vowel after the g, even though it is not immediately after)
code: codtete
president: preszizi
This is code-golf, so please make your program as short as possible!
7"x" should technically map onto "gz". "qu" should map onto "gw". – Steve Bennett – 2017-06-05T05:34:49.310
3
This specifies one concept of covfefification but I keep feeling that a reference to Douglas Hofstadter's (and Melanie Mitchell's) work on string-conversion analogies, e.g. in Fluid Concepts seems appropriate.
– Mars – 2017-06-07T05:51:11.11364Answers over 140 characters should be disqualified – Sandy Gifford – 2017-06-07T15:27:53.263
12Unfortunately it is impossible to do this in TrumpScript :( – None – 2017-06-14T22:09:21.887
@SandyGifford No, see the list of things to avoid when writing a challenge. https://codegolf.meta.stackexchange.com/a/8928/75773
– ThePlasmaRailgun – 2017-12-19T22:25:30.5732@ThePlasmaRailgun dude... – Sandy Gifford – 2017-12-20T14:57:02.283
4@ThePlasmaRailgun It was a joke, since tweets have to be 140 characters or less. – Esolanging Fruit – 2017-12-31T22:14:50.063