| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:例子:abcba——》aabcb 错In Reply To:Why WA?Who can help me?Thanks. Posted by:nb at 2005-05-05 18:57:11 > //FileName : 146.cpp
>
> //Author : Wang Bo
>
>
>
>
> #include <iostream.h>
>
> #include <string.h>
>
>
>
> int main()
>
> {
>
> char line[55];
>
> short i,j,len;
>
>
>
> while(1)
>
> {
>
> cin>>line;
>
> if(line[0]=='#')
>
> break;
>
> len=strlen(line);
>
> for(i=len-1;i && line[i-1]>=line[i];i--)
>
> ;
>
> if(i==0)
>
> {
>
> cout<<"No Successor"<<endl;
>
> continue;
>
> }
>
> for(j=0;j<i-1;j++)
>
> cout<<line[j];
>
> cout<<line[len-1];
>
> for(j=i-1;j<len-1;j++)
>
> cout<<line[j];
>
> cout<<endl;
>
> }
>
> return 0;
>
> }
>
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator