in cpp, the elements in the unordered_map are not sorted in any particular order with respect to either their key or mapped values. You can assume data are in random order, not following the sequence you put data in.
So your matching is correct but wrong in ordering.
1 Like