I have two space separated strings… (the X doesn’t mean the same symbol)
st1 = "abc def kok...."
st2 = "kok bbr def ffe ...."
i would like to construct an intersection string as follows:
common = "kok def"
what is the efficient way to do so in c++?
Thanks
Use
std::set_intersectionSample program:
I’m assuming you’ve tokenized your strings already (this solution seems easy to implement).
Complexity should be O(n log n) in the number of tokens (or sub-strings).