The sporting world recently underwent a media overload with the Brett Favre story. The record-breaking Green Bay Packers quarterback, after initially deciding to retire in March, had second thoughts about his decision in the summer. Had Green Bay simply let Brett join the team again, this would not have been much of a story. But, the real saga was quite a bit more complicated. As everyone knows, the media tends to pick individual stories and follows them to no end, much like the O.J. Simpson trial coverage. ESPN treated the Brett Favre story with the same diligence.
You are a football fan and are interested in the Favre story, but enough is enough. You are sick and tired of getting insignificant updates such as, "Brett Favre eats hot dog" on your cell phone. You want to write a program for your cell phone so that it filters Brett Favre news and only reports to you important information, namely whenever he travels to a new city.
Given a list of cities, and a log of chronological information (with a date and time) about Brett Favre, isolate the log entries that contain the name of a city (from the list of cities) different from the city mentioned in the previous log entry with a city. You will be guaranteed that the very first item in the log will contain the name of a city. From that point on, a new log entry is only printed if it contains the name of a city DIFFERENT than the previous log entry with a city (note that the "previous log entry with a city" may not be the "immediate previous log entry"). Your job will simply be to print out the lines of the log that should be presented on the cell phone text feed.
Note: A city is only considered to be in a log entry if it appears EXACTLY, character by character, in the log entry. Namely, capitalization has to match as well as all non-letter characters. However, for our comparison purposes, if the city name is (say) AB and the log entry contains (say) CABD, then the log contains the city, i.e., there doesn't have to be space or punctuation mark before/after the city name in the log.
At the beginning of each test case, output "Brett Log #p:", on a ine by itself, where pp is the test case number (starting from 1). The following lines should simply contain, in order, the lines from the entry log that are significant, according to the given criteria.
Leave a blank line after the output for each test case. Follow the format illustrated in Sample Output.
2 4 Green Bay Hattiesburg New York Cleveland, Ohio 7 7/23 5:00 PM: Brett leaves Hattiesburg in private plane. 7/23 5:10 PM: Brett eats breakfast omelet on plane. 7/23 5:20 PM: Did I mention Brett is leaving Hattiesburg? 7/23 5:30 PM: Brett falls asleep on plane. 7/23 7:45 PM: Brett lands in Green Bay to waiting fans. 7/23 8:15 PM: Brett watches Packers practice. 7/23 8:20 PM: Deanna is watching practice as well. 2 Cleveland, Ohio New York 5 7/25 10:00 AM: Brett arrives in New York. 7/25 11:00 AM: Brett does press conference in New York. 7/25 1:25 PM: Brett flies to Cleveland, Ohio. 7/25 4:45 PM: Brett does press conference in Cleveland, Ohio. 7/25 6:00 PM: Brett walks onto field in Cleveland, Ohio.
Brett Log #1: 7/23 5:00 PM: Brett leaves Hattiesburg in private plane. 7/23 7:45 PM: Brett lands in Green Bay to waiting fans. Brett Log #2: 7/25 10:00 AM: Brett arrives in New York. 7/25 1:25 PM: Brett flies to Cleveland, Ohio.