Problem B
Lög
Languages
en
is
One day, like many others, Kristján and Bergur were sat in a hot tub in Vesturbæjarlaug, one of the capital’s swimming pools. They were discussing The Beatles, one of Kristján’s favourite bands, when Bergur began wondering whether the Beatles had ever released a song with a title that had as many letters as the name of the band. After being given some time to ponder, Kristján pointed out the song Drive my Car which contains as many letters as The Beatles, not counting spaces. Bergur prefers Bruce Springsteen though and thus began to wonder if he had a similar song. He thought for quite a while (since counting to $16$ is quite a task) but finally came up with Highway Patrolman.
Can you help Bergur and Kristján by making a program that finds all such songs for given musicians and bands?
Input
The first line of the input contains the integer $1 \leq t \leq 100$. After that follow $t$ cases. Each case begins with a line that contains the integer $1 \leq n \leq 100$. After that comes a line that contains the name of a musician or band. After that come $n$ lines that each contain the title of a song. The names of songs, bands and musicians will never be more than $100$ characters (counting spaces) and will only contain letters from the English alphabet and spaces.
Output
The output of each case is to begin with the name of the musician or band on their own line with a colon (‘:’) just before the line break. Then, each on their own line, the song titles which have as many letters as the musician or band should follow in alphabetical order.
Sample Input 1 | Sample Output 1 |
---|---|
3 6 The Beatles Yesterday Let it Be Yellow Submarine Drive my Car Penny Lane Help 5 Bruce Springsteen The Ties That Bind Jungleland Mansion on the Hill Highway Patrolman Reason to Believe 3 Nirvana Smells like Teen Spirit Even in His Youth Lithium |
The Beatles: Drive my Car Bruce Springsteen: Highway Patrolman Mansion on the Hill Nirvana: Lithium |
Sample Input 2 | Sample Output 2 |
---|---|
2 1 a a 1 a a |
a: a a: a |