第一届宁波绍兴小学生程序设计竞赛解答.docVIP

  • 1
  • 0
  • 约2.32千字
  • 约 4页
  • 2024-08-10 发布于广西
  • 举报

第一届宁波绍兴小学生程序设计竞赛解答.doc

programcoding;

vara:string;

b:array[1..26]ofinteger;

i,k,j:integer;

temp:char;

c:array[1..26,1..2]ofchar;

begin

read(a);

k:=1;

fori:=1tolength(a)do

begin

inc(b[ord(a[i])-96]);

end;

fori:=1to26do

begin

ifb[i]0then

begin

c[k,1]:=chr(i+96);c[k,2]:=chr(b[i]+48);

k:=k+1;

end;

end;

fori:=1tok-2do

forj:=i+1tok-1do

begin

ifc[i,2]c[j,2]then

begin

temp:=c[i,2];

c[i,2]:=c[j,2];

c[j,2]:=temp;

temp:=c[i,1];

c[i,1]:=c[j,1];

c[j,1]:=temp;

end;

end

文档评论(0)

1亿VIP精品文档

相关文档