Minutemen
Gozz is now president of UCC and has set himself the task of returning the club to glory. In this quest he must review UCC scripture in search of a great Oracle. Unfortunately you have been confused for a member (that cares) and have been set the task of finding the Oracle. Gozz has given you a copy of the minutes dating back years and an array of clever words that an Oracle would totally use. He suggested you search the minutes for the longest clever words used and report back.
A word is considered to occur in the minutes regardless of the case. So kek
would match kEK
. Also, the Oracle can be really sneaky and a hide a word inside another. For example no
would match Not
. Also, the oracle will never use words with punctuation, so dont
should not match don't
, but it will match dont.
, since the .
is outside the word. In short, a word used by the Oracle must occur somewhere as a substring.
Input Specification
The first line contains the entire history of the UCC minutes, and has between 1 and 100 characters inclusive. The second line contains an integer \(N\) (\(1\leq N \leq 10\)) denoting the number of lines to follow. The next \(N\) lines contain a single word, which is a lowercase alphabetic string with no spaces.
Output Specification
Output the longest clever word that occurs in the minutes. If there are multiple longest words, output each on their own line in the order they occurred in the input. If there are none, do not output anything.
Sample Input 1
If computers get too powerful, we can organize them into committees. That'll do them in.
5
functional
persistant
computers
gandalf
organize
Sample Output 1
computers
Sample Input 2
The best thing about a boolean is even if you're wrong, you are only off by a bit.
3
lasagna
boolean
bit
Sample Output 2
boolean
Comments
Nvm got it
Any hints as to why my incredibly fragile code is failing the last test case? ( ͡ಥ ͜ʖ ͡ಥ)