i can't find the error why wa??

dishes
small

#1

#include
#include

using namespace std;

int main()
{
int t;

cin>>t;

string h;

getline(cin,h);

while(t--)
{
     string s1;
     string s2[4];
     int c=0;

    getline(cin,s1);
    for(int i=0;i<4;i++) cin>>s2*;


    for(int i=0;i<4;i++)
    {
        if(s1.find(s2*) !=string::npos) c++;
    }

    if(c<2) cout<<"dissimilar

";
else cout<<"similar
";

     getline(cin,h);


}

return 0;

}


#2

The error was that u didn’t write ‘#’ before including the the libraries .

Just add that and your code will work:)


#3

The error is because you are comparing parts of the string and not the whole word for example
tc#1
1
cook chef is good
coo ch no bad
will give you output similar but the result should be dissimilar
the reason for the output to be similar is s1.find(s2*) if true for coo as it finds “coo” in “cook” :confused:
So just take 2 string 1-D arrays of size 4 and compare each word if then c>2 print similar else dissimilar. I
hope this helps :)!!


#4

actually he added ‘#’ but since he just pasted it directly # is converted into heading due to markdown.


#5

Can u tell he question