Build new empty hash 'output' Build a list of keys from longest to shortest For each key in the list If key not a fragment of a key in the output hash Add key to output hash #### my %phrase_counts = ( 'rendition' => '3', 'automation' => '2', 'saturation' => '3', 'mass creation' => 2, 'automation technology' => 2, 'automation technology process' => 3, 'technology process' => 5, 'automation process' => 2, );