fork download
  1. program remix;
  2. Uses Sysutils;
  3. {$H+}
  4. const
  5. MAXN = 100000;
  6. var
  7. N,i, contacaratteri: longint;
  8. ST, nuovaST,a: Ansistring;
  9.  
  10. remixx, testo : array[0..MAXN] of char;
  11. spazio:boolean;
  12.  
  13. procedure ripulisci(numchar: longint; var R,T: array of char);
  14. var h,k:longint;
  15. begin
  16. k:=0; h:=0; spazio:=false;
  17. while h<numchar do
  18. if ((R[h]<>'P') or (R[h+1]<>'a') or (R[h+2]<>'H')) and ((R[h]<>'T') or (R[h+1]<>'u') or (R[h+2]<>'N') or (R[h+3]<>'Z')) then begin T[K]:=R[h]; k:=k+1; h:= h+1; spazio:=true; end
  19. else
  20. if ((R[h]='P') and (R[h+1]='a') and (R[h+2]='H')) then begin h:=h+3; if spazio=true then T[k]:=' '; spazio:=false; k:=k+1; end
  21. else begin h:=h+4; if spazio=true then T[k]:=' '; spazio:=false; k:=k+1; end;
  22.  
  23. contacaratteri:=k;
  24. end;
  25.  
  26. begin
  27. (*assign(input, 'input.txt'); reset(input);
  28.   assign(output, 'output.txt'); rewrite(output);*)
  29. readln(N);
  30. readln(ST);
  31. ST:=Trim(ST);
  32. for i:=0 to N-1 do remixx[i]:=ST[i+1];
  33. ripulisci(N, remixx, testo);
  34. nuovaST:='';
  35. for i:=0 to contacaratteri-1 do if ord(testo[i])<>0 then nuovaST:=nuovaST+testo[i];
  36. nuovaST:=trimleft(nuovaST);
  37. nuovaST:=trimRight(nuovaST);
  38. writeln(nuovaST);
  39. writeln(ord(nuovaST[7]));
  40. end.
  41.  
Success #stdin #stdout 0.01s 5284KB
stdin
27
TuNZTuNZSettePaHPaHTuNZOtto
stdout
Sette Otto
79