Problem B
Lög
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
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
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 |