Finding common characters in two strings

前端 未结 13 2602
终归单人心
终归单人心 2020-12-15 14:09

I am coding for the problem in which we got to count the number of common characters in two strings. Main part of the count goes like this

for(i=0; i < st         


        
13条回答
  •  被撕碎了的回忆
    2020-12-15 14:28

    for (std::vector::iterator i = s1.begin(); i != s1.end(); ++i)
    {
        if (std::find(s2.begin(), s2.end(), *i) != s2.end())
       {
        dest.push_back(*i);
       }
    }
    

    taken from here

提交回复
热议问题