Find Speedster

Company: IBM Backend Developer_15may

Difficulty: easy

Problem Statement

Find Speedster A marathon results database holds one record per runner per race. Each record carries the marathon the runner entered, the runner's name, the runner's sex, the top speed the runner reached during that race, and the number of stops the runner took. Given the whole database and one query — a marathon name and a sex — report the speedster : the runner of that sex, in that marathon, who reached the highest top_speed . Two runners can reach the same top speed. When that happens the title goes to the one who took fewer stops . If they are still tied — same top speed and the same number of stops — the title goes to whichever of them appears earlier in the database listing . If the query matches no record at all, there is no speedster and the answer is the empty string. Input Format The first line contains a single integer N , the number of records in the database. Each of the next N lines describes one record as five fields separated by the vertical bar character | , in this or