7
1
The Typical Way to Make an Acronym Out of a Phrase Is to Take the First Letter of Each Word: TTWMAOPITFLEW
. howeveR, sometimEs, you can make an acronym of random leTters In a seNtence such As like this: RETINA
. The only condition is that the letters have to be in the correct order. For instance:
LORD
can be acronymised fromHello World
:heLlO woRlD
LEOD
cannot be acronymised fromHello World
, as nol
s are beforee
Your task is to take two strings as input as to determine if one can be acronymised into the other.
The first input, the phrase, will only contain letters (A-Z
or a-z
) and spaces, and the second input, the acronym, will only contain letters (A-Z
or a-z
). The acronym will always be shorter, or of equal size, to the phrase, and both the acronym and the phrase will be, at minimum, 1 letter long. You may choose which case (upper or lower) you want the inputs to be.
You may choose any two values to represent true
and false
, as long as those values are consistent.
This is code-golf so the shortest code in bytes wins
Examples
HELLO WORLD, LORD -> true
CODE GOLF AND CODING CHALLENGES, DANGLE -> true
SANDBOX FOR PROPOSED CHALLENGES, CODE -> false
HELLO WORLD, LLLD -> true
HELLO WORLD, LLDL -> false
NEW YORK POLICE DEPARTMENT, NOODLE -> false
MASSACHUSETTS INSTITUTE OF TECHNOLOGY, MUTTON -> true
BOB, BOB -> true
PRESIDENT OF THE UNITED STATES, I -> true
Deleted Sandbox post – caird coinheringaahing – 2019-08-20T12:45:29.690
PRESIDENT OF THE UNITED STATES, I -> true , doesn't have to contain at least one letter from every word? – AZTECCO – 2019-08-20T12:59:52.327
@AZTECCO The only condition is that the letters have to be in the correct order. – Adám – 2019-08-20T13:14:32.117
5
Probably a duplicate of this - someone else can hammer closed if I am correct.
– Jonathan Allan – 2019-08-20T17:46:58.2202Having read through this and the proposed duplicate I am firmly of the opinion answers are transferable in either direction. – Jonathan Allan – 2019-08-20T18:00:54.357
1@JonathanAllan Agreed, some of the answers are even identical. – xnor – 2019-08-20T18:01:35.467
This question can be corrected following Wikipedia definitions.. Acronyms result from a word formation process known as blending, in which parts of two or more words are combined to form a new word. Seems more conforming than the specifications of this question to me. As I said before. – AZTECCO – 2019-08-20T19:33:50.890
1@AZTECCO with 23 answers here it would probably be better to start a new question instead of fixing this one up. – Jonathan Allan – 2019-08-20T20:33:08.520
Yes for sure @Jonathan, agreed. – AZTECCO – 2019-08-20T21:26:01.440
3There is no need to downvote this challenge simply for being a duplicate. If the fact that this is a duplicate wasn't caught in the Sandbox, there's nothing I could've done to prevent this being a duplicate. – caird coinheringaahing – 2019-08-21T14:01:12.960