hackerrank sales by match problem