Page 7 of 9

Posted: Tue Oct 30, 2007 3:41 pm
by helloneo
Try this case..

Code: Select all

a b
:-)

PS. Remove your code after AC..

WA

Posted: Thu Jan 24, 2008 7:24 pm
by DanielMarques
Getting WA in this code. I've already tried the cases posted here and they all worked.

Code: Select all

Got AC

Posted: Tue Feb 12, 2008 8:43 pm
by sapnil
Cheque this:

Code: Select all

Input:
aa ab
Output:
No
Thanks
Keep posting
Sapnil

Posted: Wed Feb 13, 2008 10:25 pm
by DanielMarques
It worked! :D
Thanks sapnil

why is my programm giving WA

Posted: Sun Feb 24, 2008 7:24 am
by fR0D
here's my code..i cant understand y it gives WA plz help..

Code: Select all

#include<iostream>
using namespace std;
#include<string.h>

int main()
{
    char str1[1000000],str2[1000000];
    int l1,l2,i,j,FLAG=1;
    while (scanf("%s%s",str1,str2)!=EOF)
    {
          FLAG=1;
          l1=strlen(str1);
          l2=strlen(str2);
          for (i=0,j=0;i<l1 && j<l2 && l1<=l2;i++)
          {
              for (;j<l2;j++)
                   if (str1[i]==str2[j])     
                   {    
                      j++;
                      break;
                   }
          }                    
          if(i!=l1 || (l1==l2 && strcmp(str1,str2)!=0))
                   FLAG=0;
          if(FLAG==0)
                     printf("No\n");
          else
              printf("Yes\n");
    }
}

Posted: Sun Feb 24, 2008 7:28 am
by fR0D
what is the output in case of
input:

abc abc

Posted: Tue Feb 26, 2008 5:41 pm
by Jan
Yes.

Posted: Wed Feb 27, 2008 9:14 am
by fR0D
can u give some tricky cases or figur out why my program gives WA??

Posted: Wed Feb 27, 2008 9:00 pm
by Jan
Try the case.

Input:

Code: Select all

abcc abcdddd
Output:

Code: Select all

No
Hope it helps.

10340 - WA

Posted: Fri May 23, 2008 10:50 pm
by diegororiz
I've got a RE and i do'nt know why!
If anybody can help me!!

Code: Select all

Got acc
thks!

Re:

Posted: Mon Jun 02, 2008 12:02 pm
by The_Madman
asif_rahman0 wrote:Array size should be 1000000.
thanx bro....it really helped and now's been accepted. but here comes a question....how can one assume the length of these string type questions...some days ago...i was stuck by this same kind of prob..while the algo was ok..it needed to change the string length to 1000 so this time i thought 1000 is sufficient..but alas!

do you know anything regarding it?

WA pls help

Posted: Thu Jul 17, 2008 12:17 am
by theharshest
I am getting WA for this code -- pls help :(

Code: Select all

#include<iostream>
#include<string>

using namespace std;

int main()
{

string s,t;

long i,j;

while(cin>>s>>t)
{
 i=0;
 j=0;
 while(1)
 {
  if(s[i]==t[j])
  {
  if(s[i-1]==t[j-1] || i==0 || j==0)
   {i++;
   j++;}
   else
   j++;
  }          
  else
   j++;
  
 //cout<<s[i]<<" "<<t[j]<<endl;
  if(i==(s.length()) || j==(t.length()))
  break;              
 }
 if(i==(s.length()))
 cout<<"Yes"<<endl;
 else
 cout<<"No"<<endl;
 
}    

}

Re: 10340 - All in All

Posted: Mon Jul 28, 2008 6:23 am
by rio
Your code doesn't even pass the sample io.
Try to output it correctly, and you'll understand wheres your mistake is.

-----
Rio

Re: 10340 - All in All

Posted: Fri Nov 26, 2010 11:52 pm
by fjfj
why WA???
please help!! :cry: :cry:

Code: Select all

#include <stdio.h>
#include <string.h>
char *s1,*s2,s[2000010];
int main()
{
	char flag,i,j,l1,l2,k;
	while (gets(s)!=NULL)
	{
		s1=strtok(s," ");
		s2=strtok(NULL," ");
		l1=strlen(s1);
		l2=strlen(s2);
		if (l1>l2)
		{
			printf("No\n");
			continue;
		}
		else if (strstr(s1,s2)!=NULL)
		{
			printf("Yes\n");
			continue;
		}
		else
		{
			k=0;
			for (i=0;s1[i]!='\0';i++)
			{
				flag=0;
				for (j=k;s2[j]!='\0';j++)
				{
					if (s1[i]==s2[j])
					{
						flag=1;
						s2[j]=' ';
						k=j;
						break;
					}
				}
				if (flag==0)
					break;
			}
			if (flag==0)
				printf("No\n");
			else if (flag==1)
				printf("Yes\n");
		}
	}
	return 0;
}

Re: 10340 - All in All

Posted: Mon Jun 11, 2012 11:50 pm
by sith
Hello!
I've got WA but I believe that my solution is correct. All cases from this thread, proof it.

Here is my code

Code: Select all

AC
Helppppppp!