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 |
为什么会wrong answer.哪位大哥看看吧var s:string; procedure work(s:string); var a:array['a'..'z'] of integer; len,i,j:integer; ch:char; begin fillchar(a,sizeof(a),0); len:=length(s); ch:=s[len]; i:=len-1; while (i>0) and (ch<=s[i]) do begin inc(a[s[i]]); dec(i); end; if i<>0 then inc(a[s[i]]); if i=0 then writeln('No Successor') else begin for j:=1 to i-1 do write(s[j]); write(ch); for ch:='a' to 'z' do while a[ch]<>0 do begin write(ch);dec(a[ch]);end; writeln; end; end; begin repeat readln(s); if s='#' then break; work(s); until false; end. Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator