Amazon's Retail Analytics team wants to discover which pairs of items are most often bought together so they can create 'Frequently Bought Together' bundles.
During a short observation window, each customer order is recorded as a space-separated list of SKU strings (for example 'B07 B08 B09'). Within a single order, the same SKU may repeat, but repeats count only once toward a bundle.
Your task is to find the pair of distinct SKUs that appears in the highest number of orders. If several pairs tie for first place, return the lexicographically smallest pair (compare first SKU, then second).
orders = ['B07 B08 B09', 'B07 B08', 'B08 B09']
Order-level pairs #1 {B07,B08}, {B07,B09}, {B08,B09} #2 {B07,B08} #3 {B08,B09}
Global counts {B07, B08} => 2 {B07, B09} => 1 {B08, B09} => 2 highest (tie)
Tie-break gives {B07,B08}.
Hard