题目: |
program t2014_1;
var s,s1:string;
i,k,n:integer;
begin
s:='abbccdgggvvvvvv33333*';
i:=1;
repeat
n:=1;k:=i+1;
while s[i]=s[k] do begin
n:=n+1;delete(s,k,1);
end;
if n>1 then
begin
str(n,s1);
insert(s1,s,k)
end;
i:=i+1;
until s[i]='*';
writeln(s);
end.
输出:ab2c2dg3v635*
|