简单模拟题,小心点即可

program expand;
var
  s:string;
  p,p1,p2,p3:integer;
procedure work;
var
  i,j,l,r:integer;
  s1:string;
begin
  if p1=3 then
  begin
    for i:=1 to (ord(s[p+1])-ord(s[p-1])-1)*p2 do
      write('*');
    exit;
  end;
  s1:='';
  if (s[p-1]>='0') and (s[p-1]<='9') or (p1=1) then
  begin
    l:=ord(s[p-1])+1;
    r:=ord(s[p+1])-1;
  end
  else
  begin
    l:=ord(s[p-1])-ord('a')+ord('A')+1;
    r:=ord(s[p+1])-ord('a')+ord('A')-1;
  end;
  for i:=l to r do
    for j:=1 to p2 do
      s1:=s1+chr(i);
  if p3=1 then write(s1)
    else if p3=2 then
    begin
      for i:=length(s1) downto 1 do
        write(s1[i]);
    end;
end;
function check(c1,c2:char):boolean;
begin
  if ((c1>='a') and (c1<='z') and (c2>='a') and (c2<='z')) or ((c1>='0') and (c1<='9') and (c2>='0') and (c2<='9')) then exit(true)
    else exit(false);
end;
begin
  assign(input,'expand.in');
  reset(input);
  assign(output,'expand.out');
  rewrite(output);
  readln(p1,p2,p3);
  readln(s);
  p:=pos('-',s);
  while p<>0 do
  begin
    if p=1 then write('-')
      else if check(s[p-1],s[p+1]) then
      begin
        write(copy(s,1,p-1));
          if ord(s[p-1])>=ord(s[p+1]) then write('-')
            else if ord(s[p-1])<>ord(s[p+1]) then work;
      end
      else write(copy(s,1,p));
    delete(s,1,p);
    p:=pos('-',s);
  end;
  writeln(s);
  close(input);
  close(output);
end.