find the longest of the shortest

HDU - 1595