## [Retina](https://github.com/mbuettner/retina), <s>37</s> 36 bytes M!&s`\G(\w+?)(?!.*\1) O$#`.+ $.& G1` Output is empty if no valid substring is found in `A`. [Try it online!][1] (Slightly modified to run several test cases at once. The input format is actually linefeed separated, but test suites are easiest to write with one test case per line. The test framework turns the space into a linefeed before the actual code starts.) [1]: http://retina.tryitonline.net/#code=JShgXHMKJG4KTSEmc2BcRyhcdys_KSg_IS4qXDEpCk8kI2AuKwokLiYKRzFg&input=YWJjZCBhYmMKYWJjZCBkYWJjCmFiY2QgZGNiYWJiY2NkCmFiYyBhYmMKYWJjZGYgYWJjZGViY2Rm