• + 0 comments

    c++ C++ cpp

    int main() { vector str = {"aba", "baba", "aba", "xzxb"}; vector query = {"aba", "xzxb", "ab"}; vector a; int counter=0;

    for (string qry : query) {
        //cout << qry << endl;
        for (string strng : str) {
            if(strng == qry){
                counter++;
            }
        }
        a.push_back(counter);
        counter=0;
    }
    
    // Display the updated vector
    for (int i : a) {
        cout << i << endl;
    }
    
    return 0;
    }