Page 3 of 3
Posted: Mon Jun 18, 2007 4:41 pm
by Jan
Try the cases.
Input:
Code: Select all
aaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaabcaaaaaaaaaaa
#
Output:
Code: Select all
aaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaa
No Successor
aaaaaaaaaaaaaaaaaaaacaaaaaaaaaaab
Hope these help. And if your code passes you can post your code, too. [ Use code tags if you want to post your code ]
Posted: Sun Jul 22, 2007 1:53 pm
by newton
i am extremely sorry. it was a chilly mistake [spelling mistake]. but it should be WA!
why PE??
Posted: Sun Jul 22, 2007 1:56 pm
by Jan
Your code doesn't even pass the samples. Check carefully.
Re: 146 ID Codes
Posted: Fri Jul 24, 2009 9:04 am
by masud93
I am getting WA.plz check my code.
Code: Select all
#include<stdio.h>
#include<string.h>
int main()
{
int i,j,temp,f,n,k,m;
char x[1000],y[]="#";
while(scanf("%s",x)==1)
{
n=strlen(x);
if(!(strcmp(y,x)))
break;
for(i=n-1,f=0;i>0;i--)
{
if(x[i]>x[i-1])
{
f=1;
temp=x[i];
x[i]=x[i-1];
x[i-1]=temp;
break;
}
}
if(f==1)
{
for(k=0,m=i ;m<n-1;m++,k++ )
{
for(j=i;j<n-1-k;j++)
{
if(x[j]>x[j+1])
{
temp=x[j];
x[j]=x[j+1];
x[j+1]=temp;
}
}
}
puts(x);
}
else
printf("No Successor\n");
}
return 0;
}
Re:
Posted: Tue Oct 08, 2013 5:37 pm
by enamsustcse
UFP2161 wrote:cxxoc --> occxx
This test case was very helpful for me, Thanks to all belonging to this problem

Re: 146 - ID Codes
Posted: Tue Apr 21, 2015 1:07 pm
by uDebug
Added some input to help with testing / debugging here:
http://www.udebug.com/UVa/146