implement common_prefix_search