Pattern transform

a long time we speak about it.... Here it is.
I think len_set make sure it is len(set(...)) function without doubt while we may not know where count_unique come from.
Also, std::unordered_set should be faster than set only for big one. And I have no idea what is use the most. I think only real code improvement can lead to this modification.