• 9

## Learning Opportunities

This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.

## Goal

When two famous people get together and form a romantic couple, the Tabloids love to write about them and their adventures, scandals, and relationship drama.

The reporters combine (smoosh) their two individual names together to create a Couple-Name -- just for fun and to make it easier to write about them. Examples:
`π Ben + Jennifer = Benniferπ Brad + Angelina = Brangelinaπ Heidi + Spencer = Speidi`

Given the following rules, print out options for each couple.

RULES:
The overall process is:
Smoosh a left-substring (or whole name) of one person together with a right-substring (or whole name) of the other person, in such a way that there is at least 1 overlapping-letter (aka shared letter, aka common letter).
β€ Comparisons aren't case-sensitive.
β€ No spelling changes other than βsub-stringingβ
β€ Must contain at least one letter from each person, that isn't part of the overlapping-letter(s).
β€ Must not be shorter than the shortest individual-name.
β€ Cannot be the same as either of the individual names because that's just silly

Only Max Overlapping:
β€ Include only Couple-Names with the most overlapping-letters possible. For example, if there is a Couple-Name that has 2 overlapping-letters, don't show others that have less than 2 overlapping-letters.

Formatting:
β€ A Couple-Name has only the first letter capitalized, regardless of the capitalization in the individual names.
β€ Where there are multiple options, list them alphabetically on the same line separated by spaces.
β€ If no options, print NONE

Sorry I can't help more, but Keanu Reeves and I are headed out on some excellent "Lisanu" adventures, on a luxury yacht in Cannes.
Or maybe Eddie Mark Jacobson and I (βEddisaβ) will have a Big Night Out on the Gold Coast.
Input
Line 1: An integer n, denoting the number of couples
Line 2: n couples, in the format of name1 (which is always a single word) and name2 (which is always a single word) and then sometimes a last name or other extra information just as FYI, in case you need it for your Tabloid story.
(name1 and name2 -- which are ALWAYS the 1st word and 3rd word in the input string -- is all you use to make a Couple-Name)
Output
n lines: Couple-Names for each couple: name1 plus name2 = alphabetized list of Couple-Names separated by spaces, or NONE
Constraints
Names do not have anything other than letters.
Example
Input
```6
Lois and Clark
Ben and Jennifer
Tarzan and Jane
Priscilla and Elvis
Simba and Nala
Mork and Mindy```
Output
```Lois plus Clark = Clois
Ben plus Jennifer = Bennifer
Tarzan plus Jane = Tarzane
Priscilla plus Elvis = Elviscilla
Simba plus Nala = Simbala
Mork plus Mindy = NONE```

A higher resolution is required to access the IDE