You are not logged in. Please login at www.codechef.com to post your questions!

×

spellbob whats wrong in my code?

import java.io.*;

public class Main

{ public static void main(String args[])throws IOException

{
    int t;

    String str1, str2;

    InputStreamReader br = new InputStreamReader(System.in);
    BufferedReader in = new BufferedReader(br);
    t=Integer.parseInt(in.readLine());
    String x[]= new String[t];
    int i,k,c,l,j=0,T=t;
    while(t>0)
    {   k=0;l=0;c=0;
        str1=in.readLine();
        str2=in.readLine();
        for(i=0;i<3;i++)
        {
            char ch1 = str1.charAt(i);
            char ch2 = str2.charAt(i);
            if((ch1=='b')||(ch2=='b'))
            {c+=1;}
            if((ch1=='o')||(ch2=='o'))
            {k+=1;}
            if(((ch1=='o')&&(ch2=='b'))||((ch1=='b')&&(ch2=='o')))
            {l+=1;}
         }
            if((c>=2)&&(k>=1))
            {
                if((c==2)&&(k==1)&&(l==1))
                {x[j]="No";}
                else if((c==2)&&(k==2)&&(l==2))
                {x[j]="No";}
                else
                {x[j]="Yes";}
                j++;

            }
            else
            {x[j]="No";
            j++;
            }
            t--;
        }
        for(i=0;i<T;i++)
        {
        System.out.println(x[i]);
        }

    }

}

my code is right but still wrong answer is given

asked 10 Aug '18, 02:43

mnv936's gravatar image

2★mnv936
-1
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×847
×72

question asked: 10 Aug '18, 02:43

question was seen: 30 times

last updated: 10 Aug '18, 02:43