criminal XXX alias
Criminal names can have any number of words. The aliases will be single words. For example, here are a few lines that kalias might spit out:
Francis Badmeister XXX Franky-Bad Johnathan Constrictor III XXX Johnny-The-Strangler Johnathan Constrictor III XXX The-KTown-Strangler Francis Badmeister XXX Fat-Franky Francis Badmeister XXX Frank Johnathan Constrictor III XXX Johnny-Strong-Wrist Johnathan Constrictor III XXX Shrink-Wrap Francis Badmeister XXX Fat-Franky Thor XXX Thunder-KingYou'll note, sometimes it prints duplicate aliases. Your father gets irritated because this endless stream of aliases is hard for him to process. And he hates computers, of course. He wants you to write a program that does the following. It maintains all of the known aliases of each criminal. Whenever kalias emits an alias, your program should print all of the aliases for that criminal, including the new one, on one line, in lexicographic order (standard string ordering). Separate aliases by a single space. Here's an example running on the above output from kalias:
Francis Badmeister: Franky-Bad Johnathan Constrictor III: Johnny-The-Strangler Johnathan Constrictor III: Johnny-The-Strangler The-KTown-Strangler Francis Badmeister: Fat-Franky Franky-Bad Francis Badmeister: Fat-Franky Frank Franky-Bad Johnathan Constrictor III: Johnny-Strong-Wrist Johnny-The-Strangler The-KTown-Strangler Johnathan Constrictor III: Johnny-Strong-Wrist Johnny-The-Strangler Shrink-Wrap The-KTown-Strangler Francis Badmeister: Fat-Franky Frank Franky-Bad Thor: Thunder-KingI'm hoping that this is 10 minutes of programming for you. Choose the correct data structures from the STL, and make sure that you don't make excessive copies of things.