Making an acronym
Pyth, 25 21 20 bytes
shM-crz1dc4."@YK½¼
Try it here!
Thanks to @Jakube for saving one byte!
Explanation
shM-crz1dc4."@YK½¼ # z = input rz1 # convert input to uppercase c d # split input on spaces c4."@YK½¼ # create a list of the words from a packed string which shall be ignored - # filter those words out hM # only take the first letter of all words s # join them into one string
The packed string becomes ANDBYOROF
Jelly, 21 20 bytes
,“°ɲịĊs°gɗ»ṣ€⁶Œuḟ/Ḣ€
Try it online!
(-1 thanks to @Dennis.)
,“°ɲịĊs°gɗ» Pair input with the string "OR OF by AND"
ṣ€⁶ Split both by spaces
Œu Uppercase
ḟ/ Reduce filter (removing ignored words from input)
Ḣ€ Keep first letters of remaining words
Jelly's dictionary is a bit weird in that it has AND
in uppercase yet by
in lowercase...
Retina, 29 31 36 bytes
T`l`L
|(AND|OR|BY|OF)\b|\B.
Intended newline at the end.
Thanks to Martin Büttner for saving 5 bytes
Try it online
T`l`L # Replace lowercase with uppercase
|(AND|OR|BY|OF)\b|\B. # Regex match, it doesn't matter if we match 'AND' in SHAND
# since the 'SH' will still become 'S' or am I missing something?
# Replace with nothing