WRONG ANSWER ON SPELLBOB.WHY???

#include

#include

using namespace std;

int main()

{
int j=0,m=0,k=0,i=0;

char s[5]={0},t[5]={0};

cin>>k;

for( i=0;i<k;i++)

{

    m=-1;

    cin>>s>>t;

    for(j=0;j<3;j++)

    {

        if(s[j]=='o'||t[j]=='o')

        {

            m=j;

            break;

        }

    }
    if(j==3)

    {

        cout<<"no\n";

    }

    else

    {

        for(j=0;j<3;j++)

        {


            if(s[j]=='b'||t[j]=='b'||j==m)

            {

                continue;

            }

            else

            {

                cout<<"no\n";

                break;

            }

        }

        if(j==3)

        {

            cout<<"yes\n";

        }

    }

}
return 0;

}

Hi I’m not sure what’s wrong but i checked your code on various test cases, your code gave me a wrong answer on this one

1

bbo

ooo

Your output : no

Hope this helps (:

1 Like