This challenge is inspired by the meme Men of Culture.
The meme involves blanking out parts of the original caption,
Ah, I see you're a man of culture as well.
to make it appear as if the character is saying something else.
Your challenge is to write a program that, given an input, show how the original sentence can be blanked out to achieve the input string.
Rules:
- Use a
-
character to represent a blanked out character. - You must not add additional letters to achieve the input string
- You may treat string comparisons as case-insensitive
- You may ignore whitespace in string comparisions
- If no substitution is possible, output a falsy value.
- You may substitute redundant whitespace with a
-
as well, although not required. - Where multiple solutions are possible, you may output any of them.
Test cases:
Basic:
Ah, I see you're a well.
> Ah, I see you're a --- -- ------- -- well.
Ah, I see well.
> Ah, I see ------ - --- -- ------- -- well.
Edge case 1:
What did you just say about me, you little
> false
Edge case 2 (edited):
*no input*
> --- - --- ------ - --- -- ------- -- -----
Intermediate:
Ah, I see you're Orwell.
> Ah, I see you're - --- o- -----r- -- well.
Ah, ymca.
> Ah, - --- y----- - m-- -- c------ a- ----.
Ah, a manual.
> Ah, - --- ------ a man -- -u----- a- --l-.
OR: > Ah, - --- ------ a man -- -u----- a- ---l.
Harder:
tea.
> --- - --- ------ - --- -- ---t--e a- ----.
eeeee
> --- - -ee -----e - --- -- ------e -- -e---
TL;DR: Given an input string, output a string which represents how the original string should be modified to fit the input string, by using a "-" to represent a blanked out character. If a substitution is not possible, output a falsy value.
Code golf, so shortest code in bytes wins.
Edit: Clarifications
Ignore whitespace in string comparisions means you can strip away whitespace before you compare strings. For instance, the inputs
Ah, a manual
andAh , a manual
are treated as equal. Other punctuation, ' .
must be preserved. Similarly for output,Ah, a manual
is equal toAh, amanual
.substitute redundant whitespace refers to the spaces present in the original caption. You don't need to replace them with "-", but if replacing nets you more points then go ahead.
"Ah,<5 SPACES HERE>a manual."
yield? \$\endgroup\$