Using "prefixes" method to generate all prefixes