My cell phone carrier charges a cent per character in a text! I need a program to shorten the words for me, while still being understandable. I will be texting this program to my friends, so it needs to be as short as possible.
Your program will take a String (a word is separated by a non-alphanumeric character) of words from STDIN
(or closest alternative) reduce any similar (a
and A
are similar, b
and a
are not, 1
is similar only to itself) consecutive alphanumeric characters down to one character, and remove all the vowels (aeiou
), and print it to STDOUT
(or closest alternative), only letters, numbers, and spaces are kept: everything else is removed at the end. The first character of a word must remain the same, and only shorten the word if the resulting shortened word is 4 or more characters long.
Examples:
homework -> hmwrk
llamas -> llamas (lms<4 characters)
botany -> btny
y3333llow -> y3lw
shorten -> shrtn
aabcddde -> abcd
abb'bbc -> abbbbc (abb -> abb and bbc -> bbc = abb'bbc --(remove non-alphanumeric-space characters)-> abbbbc)
SHARRRKnado -> shrknd (or with capitalization bonus: SHrKnd)
abracadabra -> abrcdbr
everything is awesome! -> evrythng is awsm
you can't break what is already broken -> you cant break what is alrdy brkn
the person's cat's bed's blanket's poka-dots are orangy-yellow -> the prsns cats beds blnkts pokadots are orngyyellow
-5% bonus if kept a i o
or u
at end of word
sharknado -> shrkndo
abracadabra -> abrcdbra
-10% bonus if kept capitalization of non-consecutive characters
aAbCDdDE -> abCd
This is code-golf so the shortest program in bytes wins.
y
a vowel? \$\endgroup\$ – Doorknob♦ Nov 19 '15 at 2:52