I have a long list of strings and I'm trying to find a more efficient way of removing those elements that are prefixes of another:
example = {"Clothing", "Clothing/Accessories", "Clothing/Accessories/Belts", "Watches", "Watches/Accessories", "Watches/Accessories/Pocket Watch Chains"}
This is what I have, but it is not very optimized:
DeleteCases[example, a_ /; Or @@ Table[ StringStartsQ[b, a], {b, DeleteCases[example, a]}]]
{"Clothing/Accessories/Belts", "Watches/Accessories/Pocket Watch Chains"}
My real example has 13,732 strings and it takes 292.156 seconds to pare it down to 11,372.