From b7e55e6510690093d61f9cc1152e0330e55fe90b Mon Sep 17 00:00:00 2001 From: Raphael McSinyx Date: Tue, 28 Feb 2017 11:34:35 +0700 Subject: Update others/volume1 --- others/volume1/016.pas | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 others/volume1/016.pas (limited to 'others/volume1/016.pas') diff --git a/others/volume1/016.pas b/others/volume1/016.pas new file mode 100644 index 0000000..e50eef0 --- /dev/null +++ b/others/volume1/016.pas @@ -0,0 +1,24 @@ +var + s, z: ansistring; + i, j, k: int16; + +begin + readln(s); + readln(k); + setlength(z, length(s)); + i := 0; + j := 0; + repeat + inc(i); + while (j > 0) and + (k > 0) and + (s[i] > z[j]) do + begin + dec(j); + dec(k) + end; + inc(j); + z[j] := s[i] + until i = length(s); + writeln(z) +end. -- cgit 1.4.1