fork download
  1. program remix;
  2. const
  3. MAXN = 100000;
  4. var
  5. N,i, contacaratteri : longint;
  6. remixx, testo : array[0..MAXN] of char;
  7. spazio:boolean;
  8.  
  9. procedure ripulisci(numchar: longint; var R, T: array of char);
  10. var h,k:longint;
  11. begin
  12. k:=0; h:=0; spazio:=false;
  13. while h<numchar do
  14. 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
  15. else
  16. 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
  17. else begin h:=h+4; if spazio=true then T[k]:=' '; spazio:=false; k:=k+1;end;
  18.  
  19. contacaratteri:=K-1;
  20. end;
  21.  
  22. begin
  23. (* assign(input, 'input.txt'); reset(input);
  24.   assign(output, 'output.txt'); rewrite(output);*)
  25. readln(N);
  26. for i:=0 to N-1 do read(remixx[i]);
  27. readln;
  28. ripulisci(N, remixx, testo);
  29. for i:=0 to contacaratteri-1 do write(testo[i]); writeln;
  30. writeln(testo[contacaratteri-2])
  31. end.
  32.  
Success #stdin #stdout 0s 5284KB
stdin
299
PaHTuNZTuNZPaHPaHPaHPaHTuNZTuNZTuNZJSjlhlMPaHTuNZTuNZFaohTQPQMTuNZDwswqgQPTuNZTuNZxjkBnxFPaHPaHTuNZmmktdTuNZTUPkSPaHrpiJfldHTuNZaTuNZnFeyPaHAyIpbAVMnJTuNZsmoksbPaHTuNZFaOjyCrpPaHfQlpubgswPaHTuNZTuNZqUCgamThyPaHlLIWBVwDGTuNZpecbLfLTZQPaHPaHfqZynOxaPaHWmSSPaHUBktyPaHEpTuNZRlMHwXPaHATuNZFmBaxTuNZcKPaH
stdout
JSjlhlM FaohTQPQM DwswqgQP xjkBnxF mmktd TUPkS rpiJfldH a nFey AyIpbAVMnJ smoksb FaOjyCrp fQlpubgsw qUCgamThy lLIWBVwDG pecbLfLTZQ fqZynOxa WmSS UBkty Ep RlMHwX A FmBax cK
c