Assume you get a string. Example:
s = "FishCatRainComp_CatWater_JamDog"
And you define a sieve. A sieve - is a list of words you would like to catch up(once if multiple occurrence in s), for example:
sieve = ["Dog","Cat"]
Passing a string through a sieve should produce a string, in our case that would be:
out = "CatDog"
What would be the most elegant way to achieve the result?