AWK, 107 bytes
Try it online!
Here's a different take using GAWK... The code defines four conditions with associated code blocks. The order they are evaluated when each line is read in matters in this case, to save a couple of characters.
The first condition,
is always true given the possible inputs. The check is really unimportant here, the side effect of translating the input line to lowercase it what we care about. The code run just sets variable
a to the string
True to shorten the code.
The second condition,
is true only for the second input line, since
b isn't set until the first line is processes. So it's essentially a shortcut for
The code block is two statement, first a
for loop that processes each word in the input stream. The top of loop statement,
is just setting up
c as a shortcut for
False to save characters. Putting here saves a character, since the
; is already there.
The "should I iterate" test,
d to the current word and stops when we run off the end of the line. And the bottom of the loop statement,
e everytime the current word matches the acronym from the first line (which is in
Finally, the body of the loop appends the first character of the current word to
f, which will end up being the acronym associated with the line.
Once the loop is done, the output
$0 is set by concatenating two ternary.
(b==f?a:c) part is
False depending on whether or not the provided and constructed acronyms match. And the second part,
False based on how many words in the second line matched the acronym from the first line.
The third condition applied to each line just sets
b to the value of the first line, setting
b only if is hasn't been set already.
And the last condition is true only after the second line has been processed.
It uses the default action for unspecified code block. So it's a shortcut for
One caveat: I'm not 100% clear on the rules of the contest. If the second condition depends on the first, meaning only valid acronyms can be recursive acronyms, this slightly longer version is necessary.