#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <iostream>

using namespace std;

vector<string> function(vector<string> sequences, vector<string> second_sequences)
{
    // sort the sequences
    sort(sequences.begin(), sequences.end());
    sort(second_sequences.begin(), second_sequences.end());
    vector<string> samestrings;
    vector<string> diffstrings;

    // get the strings that are the same
    set_intersection(sequences.begin(), sequences.end(), second_sequences.begin(), second_sequences.end(), std::back_inserter(samestrings));

    // get the strings that are mismatched
    set_symmetric_difference(sequences.begin(), sequences.end(), second_sequences.begin(), second_sequences.end(), std::back_inserter(diffstrings));

    // output the results
    cout << "Same strings:" << "\n";
    copy(samestrings.begin(), samestrings.end(), ostream_iterator<string>(cout, " "));
    cout << "\nMismatch strings:" << "\n";
    copy(diffstrings.begin(), diffstrings.end(), ostream_iterator<string>(cout, " "));
    return diffstrings;
}


int main()
{
    const char *p1[] = {"abc", "123", "456", "diff", "same"};
    const char *p2[] = {"123", "diff2", "456", "same", "abc"};
    vector<string> s1(p1, p1 + 5);
    vector<string> s2(p2, p2 + 5);
    function(s1, s2);
}