Arrays

  • + 0 comments

    include

    include

    include

    using namespace std;

    int main() { int x, y; cin >> x >> y; string temp; getline(cin, temp); string Reference; getline(cin, Reference); string Pattern; getline(cin, Pattern);

    string buf;
    stringstream ss(Pattern);
    vector <string> tokens;
    bool flag = false;
    int count = 0;
    
    while(ss >> buf)
    {
        tokens.push_back(buf);
    }
    
    vector<string>::iterator it;
    
    vector<string> RefTokens;
    stringstream sS(Reference);
    
    string Buf;
    while(sS >> Buf)
    {
        RefTokens.push_back(Buf);
    }
    
    vector<string>::iterator jt;
    for(it = tokens.begin(); it != tokens.end(); ++it)
    {
        string str = *it;
        flag = false;
        for(jt = RefTokens.begin(); jt != RefTokens.end(); ++jt)
        {
            string Str = *jt;
            if(str == Str)
            {
                flag = true;
                count++;
            }
        }
        if(!flag)
        {
            break;
        }
    }
    
    if(flag)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    return 0;
    

    }

    //Hey Gerasiov //What is wrong with my c++ solution. It is giving wrong an //swer for some test cases.